Skip to content

Commit

Permalink
Merge branch 'kh/commit' into wc/add-i
Browse files Browse the repository at this point in the history
This is to use a few functions refactored to use in the built-in
commit series.

* kh/commit: (28 commits)
  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.
  builtin-commit: Clean up an unused variable and a debug fprintf().
  Call refresh_cache() when updating the user index for --only commits.
  builtin-commit: Add newline when showing which commit was created
  builtin-commit: resurrect behavior for multiple -m options
  builtin-commit --s: add a newline if the last line was not a S-o-b
  builtin-commit: fix --signoff
  git status: show relative paths when run in a subdirectory
  builtin-commit: Refresh cache after adding files.
  builtin-commit: fix reflog message generation
  launch_editor(): read the file, even when EDITOR=:
  ...
  • Loading branch information
Junio C Hamano committed Nov 25, 2007
2 parents 12db334 + b468f0c commit f64fe7b
Show file tree
Hide file tree
Showing 31 changed files with 1,255 additions and 111 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ git-rev-list
git-rev-parse
git-revert
git-rm
git-runstatus
git-send-email
git-send-pack
git-sh-setup
Expand Down
12 changes: 5 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ BASIC_LDFLAGS =

SCRIPT_SH = \
git-bisect.sh git-checkout.sh \
git-clean.sh git-clone.sh git-commit.sh \
git-clean.sh git-clone.sh \
git-ls-remote.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 \
git-sh-setup.sh \
git-am.sh \
git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
git-merge-resolve.sh git-merge-ours.sh \
git-merge-resolve.sh \
git-lost-found.sh git-quiltimport.sh git-submodule.sh \
git-filter-branch.sh \
git-stash.sh
Expand Down Expand Up @@ -260,7 +260,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-fsck-objects$X git-cherry-pick$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 @@ -330,6 +330,7 @@ BUILTIN_OBJS = \
builtin-check-attr.o \
builtin-checkout-index.o \
builtin-check-ref-format.o \
builtin-commit.o \
builtin-commit-tree.o \
builtin-count-objects.o \
builtin-describe.o \
Expand All @@ -353,6 +354,7 @@ BUILTIN_OBJS = \
builtin-mailsplit.o \
builtin-merge-base.o \
builtin-merge-file.o \
builtin-merge-ours.o \
builtin-mv.o \
builtin-name-rev.o \
builtin-pack-objects.o \
Expand All @@ -368,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 @@ -837,9 +838,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 @@ -183,9 +183,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 f64fe7b

Please sign in to comment.