Skip to content

Commit

Permalink
Merge branch 'kh/commit'
Browse files Browse the repository at this point in the history
* kh/commit: (33 commits)
  git-commit --allow-empty
  git-commit: Allow to amend a merge commit that does not change the tree
  quote_path: fix collapsing of relative paths
  Make git status usage say git status instead of git commit
  Fix --signoff in builtin-commit differently.
  git-commit: clean up die messages
  Do not generate full commit log message if it is not going to be used
  Remove git-status from list of scripts as it is builtin
  Fix off-by-one error when truncating the diff out of the commit message.
  builtin-commit.c: export GIT_INDEX_FILE for launch_editor as well.
  Add a few more tests for git-commit
  builtin-commit: Include the diff in the commit message when verbose.
  builtin-commit: fix partial-commit support
  Fix add_files_to_cache() to take pathspec, not user specified list of files
  Export three helper functions from ls-files
  builtin-commit: run commit-msg hook with correct message file
  builtin-commit: do not color status output shown in the message template
  file_exists(): dangling symlinks do exist
  Replace "runstatus" with "status" in the tests
  t7501-commit: Add test for git commit <file> with dirty index.
  ...
  • Loading branch information
Junio C Hamano committed Dec 5, 2007
2 parents 9bbe6db + 5241b6b commit 31cbb5d
Show file tree
Hide file tree
Showing 23 changed files with 1,249 additions and 103 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ git-rev-list
git-rev-parse
git-revert
git-rm
git-runstatus
git-send-email
git-send-pack
git-sh-setup
Expand Down
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ BASIC_LDFLAGS =

SCRIPT_SH = \
git-bisect.sh git-checkout.sh \
git-clone.sh git-commit.sh \
git-clone.sh \
git-merge-one-file.sh git-mergetool.sh git-parse-remote.sh \
git-pull.sh git-rebase.sh git-rebase--interactive.sh \
git-repack.sh git-request-pull.sh \
Expand All @@ -233,7 +233,7 @@ SCRIPT_PERL = \

SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
$(patsubst %.perl,%,$(SCRIPT_PERL)) \
git-status git-instaweb
git-instaweb

# ... and all the rest that could be moved out of bindir to gitexecdir
PROGRAMS = \
Expand All @@ -259,7 +259,7 @@ EXTRA_PROGRAMS =
BUILT_INS = \
git-format-patch$X git-show$X git-whatchanged$X git-cherry$X \
git-get-tar-commit-id$X git-init$X git-repo-config$X \
git-fsck-objects$X git-cherry-pick$X git-peek-remote$X \
git-fsck-objects$X git-cherry-pick$X git-peek-remote$X git-status$X \
$(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))

# what 'all' will build and 'install' will install, in gitexecdir
Expand Down Expand Up @@ -327,6 +327,7 @@ BUILTIN_OBJS = \
builtin-checkout-index.o \
builtin-check-ref-format.o \
builtin-clean.o \
builtin-commit.o \
builtin-commit-tree.o \
builtin-count-objects.o \
builtin-describe.o \
Expand Down Expand Up @@ -369,7 +370,6 @@ BUILTIN_OBJS = \
builtin-rev-parse.o \
builtin-revert.o \
builtin-rm.o \
builtin-runstatus.o \
builtin-shortlog.o \
builtin-show-branch.o \
builtin-stripspace.o \
Expand Down Expand Up @@ -833,9 +833,6 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
chmod +x $@+ && \
mv $@+ $@

git-status: git-commit
$(QUIET_GEN)cp $< $@+ && mv $@+ $@

gitweb/gitweb.cgi: gitweb/gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
Expand Down
8 changes: 5 additions & 3 deletions builtin-add.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ static void update_callback(struct diff_queue_struct *q,
}
}

void add_files_to_cache(int verbose, const char *prefix, const char **files)
void add_files_to_cache(int verbose, const char *prefix, const char **pathspec)
{
struct rev_info rev;
init_revisions(&rev, prefix);
setup_revisions(0, NULL, &rev, NULL);
rev.prune_data = get_pathspec(prefix, files);
rev.prune_data = pathspec;
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = update_callback;
rev.diffopt.format_callback_data = &verbose;
Expand Down Expand Up @@ -180,9 +180,11 @@ int cmd_add(int argc, const char **argv, const char *prefix)
newfd = hold_locked_index(&lock_file, 1);

if (take_worktree_changes) {
const char **pathspec;
if (read_cache() < 0)
die("index file corrupt");
add_files_to_cache(verbose, prefix, argv);
pathspec = get_pathspec(prefix, argv);
add_files_to_cache(verbose, prefix, pathspec);
goto finish;
}

Expand Down
Loading

0 comments on commit 31cbb5d

Please sign in to comment.