diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2007-11-11 17:35:41 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-11-22 17:05:03 -0800 |
commit | 367c98866c340bc9cf5cfa88c3b69f027165fc44 (patch) | |
tree | 6dc2ffcd92dc2d9a9ec1bac2e547434821dcf668 /builtin-commit.c | |
parent | d37d320386369375b4e5b95b98517503125376f9 (diff) | |
download | git-367c98866c340bc9cf5cfa88c3b69f027165fc44.tar.gz |
git status: show relative paths when run in a subdirectory
To show the relative paths, the function formerly called quote_crlf()
(now called quote_path()) takes the prefix as an additional argument.
While at it, the static buffers were replaced by strbufs.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-commit.c')
-rw-r--r-- | builtin-commit.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/builtin-commit.c b/builtin-commit.c index a84a729da1..400ee93a93 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -118,11 +118,12 @@ static char *prepare_index(const char **files, const char *prefix) return next_index_lock->filename; } -static int run_status(FILE *fp, const char *index_file) +static int run_status(FILE *fp, const char *index_file, const char *prefix) { struct wt_status s; wt_status_prepare(&s); + s.prefix = prefix; if (amend) { s.amend = 1; @@ -140,7 +141,7 @@ static int run_status(FILE *fp, const char *index_file) static const char sign_off_header[] = "Signed-off-by: "; -static int prepare_log_message(const char *index_file) +static int prepare_log_message(const char *index_file, const char *prefix) { struct stat statbuf; int commitable; @@ -216,7 +217,7 @@ static int prepare_log_message(const char *index_file) if (only_include_assumed) fprintf(fp, "# %s\n", only_include_assumed); - commitable = run_status(fp, index_file); + commitable = run_status(fp, index_file, prefix); fclose(fp); @@ -409,7 +410,7 @@ int cmd_status(int argc, const char **argv, const char *prefix) index_file = prepare_index(argv, prefix); - commitable = run_status(stdout, index_file); + commitable = run_status(stdout, index_file, prefix); rollback_lock_file(&lock_file); @@ -503,8 +504,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix) if (!no_verify && run_hook(index_file, "pre-commit", NULL)) exit(1); - if (!prepare_log_message(index_file) && !in_merge) { - run_status(stdout, index_file); + if (!prepare_log_message(index_file, prefix) && !in_merge) { + run_status(stdout, index_file, prefix); unlink(commit_editmsg); return 1; } |