Commit graph

11842 commits

Author SHA1 Message Date
Stephen Boyd 6622d9c710 format-patch: Add a signature option (--signature)
By default, git uses the version string as the signature for all
patches output by format-patch. Many employers (mine included)
require the use of a signature on all outgoing mails. In a
format-patch | send-email workflow there isn't an easy way to modify
the signature without breaking the pipe and manually replacing the
version string with the signature required. Instead of doing all that
work, add an option (--signature) and a config variable
(format.signature) to replace the default git version signature when
formatting patches.

This does modify the original behavior of format-patch a bit. First
off the version string is now placed in the cover letter by default.
Secondly, once the configuration variable format.signature is added
to the .config file there is no way to revert back to the default
git version signature. Instead, specifying the --no-signature option
will remove the signature from the patches entirely.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-16 10:08:59 -07:00
Ævar Arnfjörð Bjarmason ef7a8e3b95 notes: Initialize variable to appease Sun Studio
Sun Studio 12 Update 1 thinks that *t could be uninitialized,
ostensibly because it doesn't take rewrite_cmd into account in its
static analysis.

    builtin/notes.c: In function `notes_copy_from_stdin':
    builtin/notes.c:419: warning: 't' might be used uninitialized in this function

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-15 07:50:39 -07:00
Junio C Hamano 2d4fef9b86 Merge branch 'mg/notes-dry-run'
* mg/notes-dry-run:
  notes: dry-run and verbose options for prune
2010-06-13 11:22:39 -07:00
Junio C Hamano 534930807c Merge branch 'rs/grep-binary'
* rs/grep-binary:
  grep: support NUL chars in search strings for -F
  grep: use REG_STARTEND for all matching if available
  grep: continue case insensitive fixed string search after NUL chars
  grep: use memmem() for fixed string search
  grep: --name-only over binary
  grep: --count over binary
  grep: grep: refactor handling of binary mode options
  grep: add test script for binary file handling
2010-06-13 11:21:44 -07:00
Junio C Hamano 44e08b003d Merge branch 'js/try-to-free-stackable'
* js/try-to-free-stackable:
  Do not call release_pack_memory in malloc wrappers when GIT_TRACE is used
  Have set_try_to_free_routine return the previous routine
2010-06-13 11:21:21 -07:00
Junio C Hamano de8c359786 Merge branch 'jn/maint-amend-missing-name'
* jn/maint-amend-missing-name:
  commit --amend: cope with missing display name
2010-06-13 11:20:52 -07:00
Junio C Hamano 39b5977b13 Merge branch 'rs/diff-no-minimal'
* rs/diff-no-minimal:
  git diff too slow for a file
2010-06-13 11:20:46 -07:00
Christian Couder 643cb5f7c9 commit: use value of GIT_REFLOG_ACTION env variable as reflog message
The environment variable GIT_REFLOG_ACTION was used by git-commit.sh,
but when it was converted to a builtin
(f5bbc3225c, Port git commit to C,
Nov 8 2007) this was lost.

Let's use it again as it is more user friendly when reverting or
cherry-picking to see "revert" or "cherry-pick" in the reflog rather
than to just see "commit".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-13 09:42:38 -07:00
Thomas Rast 47e9cd28f8 parseopt: wrap rev-parse --parseopt usage for eval consumption
9c7304e (print the usage string on stdout instead of stderr,
2010-05-17) broke rev-parse --parseopt: when run with -h, the usage
notice on stdout ended up in the shell eval.

Wrap the usage in a cat <<\EOF ... EOF block when printing to stdout.
I do not expect any usage lines to ever start with EOF so this
shouldn't be an undue burden.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-13 09:38:14 -07:00
Johannes Schindelin 0af88c15e2 grep -O: allow optional argument specifying the pager (or editor)
Suppose you want to edit all files that contain a specific search term.
Of course, you can do something totally trivial such as

	git grep -z -e <term> | xargs -0r vi +/<term>

but maybe you are happy that the same will be achieved by

	git grep -Ovi <term>

now.

[jn: rebased and added tests]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-13 09:16:50 -07:00
Johannes Schindelin 678e484b7d grep: Add the option '--open-files-in-pager'
This adds an option to open the matching files in the pager, and if the
pager happens to be "less" (or "vi") and there is only one grep pattern,
it also jumps to the first match right away.

The short option was chose as '-O' to avoid clashes with GNU grep's
options (as suggested by Junio).

So, 'git grep -O abc' is a short form for 'less +/abc $(grep -l abc)'
except that it works also with spaces in file names, and it does not
start the pager if there was no matching file.

[jn: rebased and added tests; with error handling fix from Junio
squashed in]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-13 09:16:38 -07:00
Johannes Schindelin 685359cf2d Unify code paths of threaded greps
There were three awfully similar code paths ending the threaded grep. It
is better to avoid duplicated code, though.

This change might very well prevent a race, where the grep patterns were
free()d before waiting that all threads finished.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-13 09:15:11 -07:00
Jonathan Nieder 30d00c395e grep: refactor grep_objects loop into its own function
Simplify cmd_grep by splitting off the loop that finds matches in a
list of trees.  So now the main part of cmd_grep looks like:

	if (!use_index) {
		int hit = grep_directory(&opt, paths);
		if (use_threads)
			hit |= wait_all();
		return !hit;
	}
	if (!list.nr) {
		if (!cached)
			setup_work_tree();
		int hit = grep_cache(&opt, paths, cached);
		if (use_threads)
			hit |= wait_all;
		return !hit;
	}
	hit = grep_objects(&opt, path, &list);
	if (use_threads)
		hit |= wait_all();
	return !hit;

and is ripe for further refactoring.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-13 09:15:09 -07:00
Thomas Rast f69c501832 rev-list: introduce --count option
Add a --count option that, instead of actually listing the commits,
merely counts them.

This is mostly geared towards script use, and to this end it acts
specially when used with --left-right: it outputs the left and right
counts separately.  Previously, scripts would have to run a shell loop
or small inline script over to achieve the same.  (Without
--left-right, a simple |wc -l does the job.)

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-12 09:39:06 -07:00
Thomas Rast 157aaea5ff log_ref_setup: don't return stack-allocated array
859c301 (refs: split log_ref_write logic into log_ref_setup,
2010-05-21) refactors the stack allocation of the log_file array into
the new log_ref_setup() function, but passes it back to the caller.

Since the original intent seems to have been to split the work between
log_ref_setup and log_ref_write, make it the caller's responsibility
to allocate the buffer.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-12 09:34:17 -07:00
Jeff King f197ed2fbe commit: give advice on empty amend
We generally disallow empty commits with "git commit". The
output produced by the wt_status functions is generally
sufficient to explain what happened.

With --amend commits, however, things are a little more
confusing. We would create an empty commit not if you
actually have staged changes _now_, but if your staged
changes match HEAD^. In this case, it is not immediately
obvious why "git commit" claims no changes, but "git status"
does not. Furthermore, we should point the user in the
direction of git reset, which would eliminate the empty
commit entirely.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-11 08:55:57 -07:00
Junio C Hamano 92a75a391e Merge branch 'maint'
* maint:
  Change C99 comments to old-style C comments
2010-06-07 22:15:31 -07:00
Tor Arntsen 2543d9b609 Change C99 comments to old-style C comments
Signed-off-by: Tor Arntsen <tor@spacetec.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-07 15:50:21 -07:00
Simo Melenius 0e9716e65e branch: don't fail listing branches if one of the commits wasn't found
When listing branches with ref lookups, if one of the known raw refs
doesn't point to a commit then "git branch" would return error(),
terminating the whole for_each_rawref() iteration and possibly hiding
any remaining refs.

Signed-off-by: Simo Melenius <simo.melenius@iki.fi>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-07 15:50:00 -07:00
Simo Melenius 1603ade813 branch: exit status now reflects if branch listing finds an error
If some refs could not be read when listing branches, this can now be
observed in the exit status of the "git branch" command.

Signed-off-by: Simo Melenius <simo.melenius@iki.fi>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-07 15:48:06 -07:00
Clemens Buchacher efad1a5615 ls-files: allow relative pathspec
git ls-files used to error out if given paths which point outside the current
working directory, such as '../'. We now allow such paths and the output is
analogous to git grep -l.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-05 09:14:31 -07:00
Daniel Knittl-Frank 05a59a087c Show branch information in short output of git status
This patch adds a first line in the output of `git status -s` when given
the option `-b` or `--branch`, showing which branch the user is
currently on, and in case of tracking branches the number of commits on
each branch.

Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-03 15:02:09 -07:00
Erick Mattos 3631bf77f7 checkout --orphan: respect -l option always
Added changes to satisfy a corner case: creating reflogs by using -l
when core.logAllRefUpdates is set to false.

Signed-off-by: Erick Mattos <erick.mattos@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-03 14:46:14 -07:00
Christian Couder 7e2bfd3f99 revert: allow cherry-picking more than one commit
This makes it possible to pass many commits or ranges of
commits to "git cherry-pick" and to "git revert" to process
many commits instead of just one.

In fact commits are now enumerated with an equivalent of

	git rev-list --no-walk "$@"

so all the following are now possible:

	git cherry-pick master~2..master
	git cherry-pick ^master~2 master
	git cherry-pick master^ master

The following should be possible but does not work:

	git cherry-pick -2 master

because "git rev-list --no-walk -2 master" only outputs
one commit as "--no-walk" seems to take over "-2".

And there is currently no way to continue cherry-picking or
reverting if there is a problem with one commit. It's also
not possible to abort the whole process. Some future work
should provide the --continue and --abort options to do
just that.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-02 10:09:56 -07:00
Christian Couder 4b2095622f revert: change help_msg() to take no argument
This is needed because the following commits will make it
possible to cherry-pick many commits instead of just one.

So it will be possible to pass for example ranges of commits
to "git cherry-pick" and this means that it will not be
possible to use the arguments passed to "git cherry-pick" in
the help message.

The help message will have to use the sha1 of the currently
processed commit.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-02 10:09:52 -07:00
Christian Couder 7af46595b2 revert: refactor code into a do_pick_commit() function
This is needed because we are going to make it possible
to cherry-pick many commits instead of just one in the following
commits. And we will be able to do that by just calling
do_pick_commit() once for each commit to cherry-pick.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-02 10:09:47 -07:00
Christian Couder 2fb0e14f40 revert: use run_command_v_opt() instead of execv_git_cmd()
This is needed by the following commits, because we are going
to cherry pick many commits instead of just one.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-02 10:09:41 -07:00
Christian Couder 831244bd0d revert: cleanup code for -x option
There was some dead code and option -x appeared in the short
help message of git revert (when running "git revert -h")
which was wrong.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-02 10:09:38 -07:00
Gary V. Vaughan 4b05548fc0 enums: omit trailing comma for portability
Without this patch at least IBM VisualAge C 5.0 (I have 5.0.2) on AIX
5.1 fails to compile git.

enum style is inconsistent already, with some enums declared on one
line, some over 3 lines with the enum values all on the middle line,
sometimes with 1 enum value per line... and independently of that the
trailing comma is sometimes present and other times absent, often
mixing with/without trailing comma styles in a single file, and
sometimes in consecutive enum declarations.

Clearly, omitting the comma is the more portable style, and this patch
changes all enum declarations to use the portable omitted dangling
comma style consistently.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-31 16:59:27 -07:00
Gary V. Vaughan 66dbfd55e3 Rewrite dynamic structure initializations to runtime assignment
Unfortunately, there are still plenty of production systems with
vendor compilers that choke unless all compound declarations can be
determined statically at compile time, for example hpux10.20 (I can
provide a comprehensive list of our supported platforms that exhibit
this problem if necessary).

This patch simply breaks apart any compound declarations with dynamic
initialisation expressions, and moves the initialisation until after
the last declaration in the same block, in all the places necessary to
have the offending compilers accept the code.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-31 16:59:26 -07:00
Junio C Hamano d0b16c8f87 Merge branch 'maint'
* maint:
  Documentation/SubmittingPatches: clarify GMail section and SMTP
  show-branch: use DEFAULT_ABBREV instead of 7
  t7502-commit: fix spelling
  test get_git_work_tree() return value for NULL
2010-05-25 13:13:43 -07:00
Tay Ray Chuan bd7440fe1b show-branch: use DEFAULT_ABBREV instead of 7
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-25 09:48:49 -07:00
René Scharfe ed40a0951c grep: support NUL chars in search strings for -F
Search patterns in a file specified with -f can contain NUL characters.
The current code ignores all characters on a line after a NUL.

Pass the actual length of the line all the way from the pattern file to
fixmatch() and use it for case-sensitive fixed string matching.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-24 11:22:07 -07:00
Junio C Hamano 4d54494816 Merge branch 'pb/patch-id-plus'
* pb/patch-id-plus:
  patch-id: Add support for mbox format
  patch-id: extract parsing one diff out of generate_id_list
2010-05-21 04:02:22 -07:00
Junio C Hamano 42779124a2 Merge branch 'st/remote-tags-no-tags'
* st/remote-tags-no-tags:
  remote add: add a --[no-]tags option
  Honor "tagopt = --tags" configuration option
2010-05-21 04:02:22 -07:00
Junio C Hamano 8e3bc1456e Merge branch 'jn/shortlog'
* jn/shortlog:
  pretty: Respect --abbrev option
  shortlog: Document and test --format option
  t4201 (shortlog): Test output format with multiple authors
  t4201 (shortlog): guard setup with test_expect_success
  Documentation/shortlog: scripted users should not rely on implicit HEAD
2010-05-21 04:02:20 -07:00
Junio C Hamano 9215f76fb6 Merge branch 'js/maint-receive-pack-symref-alias'
* js/maint-receive-pack-symref-alias:
  t5516-fetch-push.sh: style cleanup
  receive-pack: detect aliased updates which can occur with symrefs
  receive-pack: switch global variable 'commands' to a parameter

Conflicts:
	t/t5516-fetch-push.sh
2010-05-21 04:02:19 -07:00
Junio C Hamano e43e48cfb6 Merge branch 'np/index-pack-memsave'
* np/index-pack-memsave:
  index-pack: smarter memory usage when appending objects
  index-pack: rationalize unpack_entry_data()
  index-pack: smarter memory usage when resolving deltas
2010-05-21 04:02:19 -07:00
Junio C Hamano a660534e06 Merge branch 'jc/maint-no-reflog-expire-unreach-for-head'
* jc/maint-no-reflog-expire-unreach-for-head:
  reflog --expire-unreachable: special case entries in "HEAD" reflog
  more war on "sleep" in tests
  Document gc.<pattern>.reflogexpire variables

Conflicts:
	Documentation/config.txt
2010-05-21 04:02:18 -07:00
Junio C Hamano e22d62d915 Merge branch 'sp/maint-describe-tiebreak-with-tagger-date'
* sp/maint-describe-tiebreak-with-tagger-date:
  describe: Break annotated tag ties by tagger date
  tag.c: Parse tagger date (if present)
  tag.c: Refactor parse_tag_buffer to be saner to program
  tag.h: Remove unused signature field
  tag.c: Correct indentation
2010-05-21 04:02:17 -07:00
Junio C Hamano cd4ce1e8a8 Merge branch 'jc/status-show-ignored'
* jc/status-show-ignored:
  wt-status: fix 'fprintf' compilation warning
  status: --ignored option shows ignored files
  wt-status: rename and restructure status-print-untracked
  wt-status: collect ignored files
  wt-status: plug memory leak while collecting untracked files
  wt-status: remove unused workdir_untracked member
2010-05-21 04:02:16 -07:00
Junio C Hamano ea5f75a64a Merge branch 'np/malloc-threading'
* np/malloc-threading:
  Thread-safe xmalloc and xrealloc needs a recursive mutex
  Make xmalloc and xrealloc thread-safe
2010-05-21 04:02:16 -07:00
Junio C Hamano af655431f5 Merge branch 'sr/remote-helper-export'
* sr/remote-helper-export:
  t5800: testgit helper requires Python support
  Makefile: Simplify handling of python scripts
  remote-helpers: add tests for testgit helper
  remote-helpers: add testgit helper
  remote-helpers: add support for an export command
  remote-helpers: allow requesing the path to the .git directory
  fast-import: always create marks_file directories
  clone: also configure url for bare clones
  clone: pass the remote name to remote_get

Conflicts:
	Makefile
2010-05-21 04:02:15 -07:00
Junio C Hamano 7f3ed824a4 Merge branch 'ar/config-from-command-line'
* ar/config-from-command-line:
  Complete prototype of git_config_from_parameters()
  Use strbufs instead of open-coded string manipulation
  Allow passing of configuration parameters in the command line
2010-05-21 04:02:14 -07:00
Junio C Hamano e2ab0227aa Merge branch 'em/checkout-orphan'
* em/checkout-orphan:
  git checkout: create unparented branch by --orphan
2010-05-21 04:02:14 -07:00
Michael J Gruber a9f2adff80 notes: dry-run and verbose options for prune
Introduce -n and -v options for "git notes prune" in complete analogy to
"git prune" so that one can check for dangling notes easily.

The output is a list of names of objects whose notes would be resp.
are removed so that one can check the object ("git show sha1") as well as
the note ("git notes show sha1").

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-19 23:57:18 -07:00
Jonathan Nieder 3d8b69495f Add git remote set-branches
Add ‘git remote set-branches’ for changing the list of tracked refs
for a remote repository with one "porcelain-level" command.  This
complements the longstanding ‘git remote add --track’ option.

The interface is based on the ‘git remote set-url’ subcommand.

   git remote set-branches base --add C
   git remote set-branches base A B D
   git remote set-branches base --delete D; # not implemented

Suggested-by: martin f. krafft <madduck@debian.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-19 20:45:41 -07:00
Michael J Gruber 67687feae5 for-each-ref: Field with abbreviated objectname
Introduce a :short modifier to objectname which outputs the abbreviated
object name.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-18 21:49:04 -07:00
Tay Ray Chuan cefb2a5e39 ls-remote: print URL when no repo is specified
After 9c00de5 (ls-remote: fall-back to default remotes when no remote
specified), when no repository is specified, ls-remote may use
the URL/remote in the config "branch.<name>.remote" or the remote
"origin"; it may not be immediately obvious to the user which was used.

In such cases, print a simple "From <URL>" line to indicate which
repository was used. This message is similar to git-fetch's, and is
printed to stderr to avoid breaking existing scripts that depend on
ls-remote's output behaviour.

It can also be disabled with -q/--quiet.

Modify tests related to falling back on default remotes to check for
this as well, and add a test to check for suppression of the message.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-11 22:55:44 -07:00
Junio C Hamano d92f844610 Merge branch 'maint'
* maint:
  handle "git --bare init <dir>" properly
2010-05-10 18:34:03 -07:00
Tay Ray Chuan f0ecac2b70 merge: --log appends shortlog to message if specified
When the user specifies a message, use fmt_merge_msg_shortlog() to
append the shortlog.

Previously, when a message was specified, we ignored the merge title
("Merge <foo> into <bar>") and shortlog from fmt_merge_msg().

Update the documentation for -m to reflect this too.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-10 12:02:20 -07:00
Tay Ray Chuan 8c6bdfdf8b fmt-merge-msg: add function to append shortlog only
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-10 12:02:14 -07:00
Tay Ray Chuan 403994e83d fmt-merge-msg: refactor merge title formatting
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-10 11:57:33 -07:00
Tay Ray Chuan 2234ec5422 fmt-merge-msg: minor refactor of fmt_merge_msg()
Shift implementation into a private function, do_fmt_merge_msg(). This
allows for further changes to the implementation, without affecting the
interface.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-10 11:57:33 -07:00
Tay Ray Chuan 97d45bcb2f merge: rename variable
It is more accurate to call it 'merge_names' instead of 'msg', as it
does not contain the final message.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-10 11:57:33 -07:00
Tay Ray Chuan 7558922028 merge: update comment
ce9d823 (merge: do not add standard message when message is given with
-m option) changed the behaviour of the code that the comment addressed,
but the comment was not similarly updated.

Fix this.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-10 11:57:32 -07:00
Jeff King 87a074df24 handle "git --bare init <dir>" properly
If we know we are creating a bare repository, we use setenv
to set the GIT_DIR directory to the current directory
(either where we already were, or one we created and chdir'd
into with "git init --bare <dir>").

However, with "git --bare init <dir>" (note the --bare as a
git wrapper option), the setup code actually sets GIT_DIR
for us, but it uses the wrong, original cwd when a directory
is given. Because our setenv does not use the overwrite
flag, it is ignored.

We need to set the overwrite flag, but only when we are
given a directory on the command line. That still allows:

  GIT_DIR=foo.git git init --bare

to work. The behavior is changed for:

  GIT_DIR=foo.git git init --bare bar.git

which used to create the repository in foo.git, but now will
use bar.git. This is more sane, as command line options
should generally override the environment.

Noticed by Oliver Hoffmann.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-10 11:25:37 -07:00
Pete Harlan 921eabde9d clone: reword messages to match the end-user perception
When cloning into a non-bare repository, e.g. "git clone $URL mine",
we used to report that we are cloning into "mine/.git".  Reword the
report to say "Cloning into mine" instead, as that matches what the
end-user asked for closer.

Make the message for "git clone --bare $URL mine" to say "Cloning
into bare repository mine" do make the distinction between this case and
the above stand out a bit more prominently.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Pete Harlan <pgit@pcharlan.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-09 15:18:10 -07:00
Junio C Hamano b7511571e3 Merge branch 'bg/apply-blank-trailing-context'
* bg/apply-blank-trailing-context:
  apply: Allow blank *trailing* context lines to match beyond EOF
2010-05-08 22:37:41 -07:00
Junio C Hamano 909376a1c9 Merge branch 'rc/ls-remote-default'
* rc/ls-remote-default:
  ls-remote: fall-back to default remotes when no remote specified
2010-05-08 22:37:28 -07:00
Junio C Hamano ea28baed79 Merge branch 'ab/commit-empty-message'
* ab/commit-empty-message:
  Add option to git-commit to allow empty log messages
2010-05-08 22:36:31 -07:00
Junio C Hamano a9eb304129 Merge branch 'jc/maint-reflog-expire-unreachable'
* jc/maint-reflog-expire-unreachable:
  reflog --expire-unreachable: avoid merge-base computation
2010-05-08 22:36:16 -07:00
Junio C Hamano 72d9b222a9 Merge branch 'sd/log-decorate'
* sd/log-decorate:
  log.decorate: only ignore it under "log --pretty=raw"
  script with rev-list instead of log
  log --pretty/--oneline: ignore log.decorate
  log.decorate: usability fixes
  Add `log.decorate' configuration variable.
  git_config_maybe_bool()

Conflicts:
	builtin/log.c
2010-05-08 22:36:14 -07:00
Junio C Hamano e251a7b34a Merge branch 'mh/status-optionally-refresh'
* mh/status-optionally-refresh:
  t7508: add a test for "git status" in a read-only repository
  git status: refresh the index if possible
  t7508: add test for "git status" refreshing the index
2010-05-08 22:35:39 -07:00
Junio C Hamano c58c5129d6 Merge branch 'cw/ws-indent-with-tab'
* cw/ws-indent-with-tab:
  whitespace: tests for git-apply --whitespace=fix with tab-in-indent
  whitespace: add tab-in-indent support for --whitespace=fix
  whitespace: replumb ws_fix_copy to take a strbuf *dst instead of char *dst
  whitespace: tests for git-diff --check with tab-in-indent error class
  whitespace: add tab-in-indent error class
  whitespace: we cannot "catch all errors known to git" anymore
2010-05-08 22:35:35 -07:00
Junio C Hamano f78eeeaf55 Merge branch 'cc/revert-strategy'
* cc/revert-strategy:
  revert: add "--strategy" option to choose merge strategy
  merge: make function try_merge_command non static
  merge: refactor code that calls "git merge-STRATEGY"
  revert: refactor merge recursive code into its own function
  revert: use strbuf to refactor the code that writes the merge message

Conflicts:
	builtin/revert.c
2010-05-08 22:34:47 -07:00
Junio C Hamano dd75d07899 Merge branch 'jk/cached-textconv'
* jk/cached-textconv:
  diff: avoid useless filespec population
  diff: cache textconv output
  textconv: refactor calls to run_textconv
  introduce notes-cache interface
  make commit_tree a library function
2010-05-08 22:33:08 -07:00
Junio C Hamano 3ecaa3b6a5 Merge branch 'pc/remove-warn'
* pc/remove-warn:
  Remove a redundant errno test in a usage of remove_path
  Introduce remove_or_warn function
  Implement the rmdir_or_warn function
  Generalise the unlink_or_warn function
2010-05-08 22:32:59 -07:00
Jonathan Nieder 43acff34b9 cherry-pick: do not dump core when iconv fails
When cherry-picking, usually the new and old commit encodings are both
UTF-8.  Most old iconv implementations do not support this trivial
conversion, so on old platforms, out->message remains NULL, and later
attempts to read it segfault.

Fix this by noticing the input and output encodings match and skipping
the iconv step, like the other reencode_string() call sites already do.
Also stop segfaulting on other iconv failures: if iconv fails for some
other reason, the best we can do is to pass the old message through.

This fixes a regression introduced in v1.7.1-rc0~15^2~2 (revert:
clarify label on conflict hunks, 2010-03-20).

Reported-by: Andreas Krey <a.krey@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-08 16:56:21 -07:00
Jonathan Nieder fb7749e4e4 commit --amend: cope with missing display name
Though I have not seen this in the wild, it has been said that there
are likely to be git repositories converted from other version control
systems with an invalid ident line like this one:

  author <user@example.com> 18746342 +0000

Because there is no space between the (empty) user name and the email
address, commit --amend chokes.  When searching for a
space-left-bracket sequence on the ident line, it finds it in the
committer line, ending up utterly confused.

Better for commit --amend to treat this like a valid ident line with
empty username and complain.

The tests remove the questionable commit objects after use so there is
no chance for them to confuse later tests.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-04 15:28:08 -07:00
Junio C Hamano 28ba96ab27 clone: quell the progress report from init and report on clone
Currently, a local git clone reports only initializing an empty
git dir, which is potentially confusing.

Instead, report that cloning is in progress and when it is done
(unless -q) is given, and suppress the init report.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-04 10:02:46 -07:00
Junio C Hamano ddb27a5a6b Merge branch 'maint'
* maint:
  index-pack: fix trivial typo in usage string
  git-submodule.sh: properly initialize shell variables
2010-05-01 20:23:10 -07:00
Junio C Hamano ddd02b70f0 Merge branch 'maint'
* maint:
  t7012: Mark missing tests as TODO
  reflog: remove 'show' from 'expire's usage string
  MSVC: Fix build by adding missing termios.h dummy
2010-04-19 22:41:30 -07:00
Samuel Tardieu 111fb85865 remote add: add a --[no-]tags option
Add '--[no-]tags' options to 'git remote add' which add the
'remote.REMOTE.tagopt = --[no-]tags' to the configuration file.
This mimics the "--tags" and "--no-tags" options of "git fetch".

Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 16:39:24 -07:00
Paolo Bonzini 580fb25b7a patch-id: Add support for mbox format
I have an alias that takes two arguments and compares their patch IDs.
I would like to use to make sure I've tested exactly what I submit
(patch by patch), like

   git patch-cmp origin/master.. file-being-sent

However, I cannot do that because git patch-id is fooled by the "-- "
trailer that git format-patch puts, or likely by the MIME boundary.

This patch adds hunk parsing logic to git patch-id in order to detect an
out of place "-" line and split the patch when it comes.  In addition,
commit ids in the "From " lines are considered and printed in the output.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 13:01:49 -07:00
Paolo Bonzini 9ae144fbf2 patch-id: extract parsing one diff out of generate_id_list
This simplifies a bit the next patch, since it will have more than one
condition to exit the loop.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 13:01:46 -07:00
Junio C Hamano 779f9467eb Merge branch 'jg/auto-initialize-notes-with-percent-n-in-format'
* jg/auto-initialize-notes-with-percent-n-in-format:
  t3301: add tests to use --format="%N"
  pretty: Initialize notes if %N is used
2010-04-18 21:31:29 -07:00
Jonathan Nieder a6ccbbdb66 tag -v: use RUN_GIT_CMD to run verify-tag
This is the preferred way to run a git command.

The only obvious observable effects I can think of are that the exec
is properly reported in GIT_TRACE output and that verifying signed
tags will still work if the git-verify-tag hard link in gitexecdir
goes missing.

Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-17 12:40:19 -07:00
Johannes Gilger 5b16360330 pretty: Initialize notes if %N is used
When using git log --pretty='%N' without an explicit --show-notes, git
would segfault. This patches fixes this behaviour by loading the needed
notes datastructures if --pretty is used and the format contains %N.
When --pretty='%N' is used together with --no-notes, %N won't be
expanded.

This is an extension to a proposed patch by Jeff King.

Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-13 18:15:08 -07:00
Junio C Hamano 2381e39e5f status: --ignored option shows ignored files
There is no stronger reason behind the choice of "!!" than just I happened
to have typed them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-10 00:43:59 -07:00
Junio C Hamano 3b0c19663e Merge branch 'maint'
* maint:
  Let check_preimage() use memset() to initialize "struct checkout"
  fetch/push: fix usage strings
2010-04-09 22:43:18 -07:00
Tay Ray Chuan 9c00de5a31 ls-remote: fall-back to default remotes when no remote specified
Instead of breaking execution when no remote (as specified in the
variable dest) is specified when git-ls-remote is invoked, continue on
and let remote_get() handle it.

This way, we are able to use the default remotes (eg. "origin",
branch.<name>.remote), as git-fetch, git-push, and other users of
remote_get(), do.

If no suitable remote is found, exit with a message describing the
issue, instead of just the usage text, as we do previously.

Add several tests to check that git-ls-remote handles the
no-remote-specified situation.

Also add a test that "git ls-remote <pattern>" does not work; we are
unable to guess the remote in that situation, as are git-fetch and
git-push.

In that test, we are testing for messages coming from two separate
processes, but we should be OK, because the second message is triggered
by closing the fd which must happen after the first message is printed.
(analysis by Jeff King.)

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-08 23:10:43 -07:00
Junio C Hamano d6b5af6d76 Merge branch 'jn/mailinfo-scissors'
* jn/mailinfo-scissors:
  Teach mailinfo %< as an alternative scissors mark
2010-04-07 15:34:06 -07:00
Ævar Arnfjörð Bjarmason c9b5fde759 Add option to git-commit to allow empty log messages
Change git-commit(1) to accept the --allow-empty-message option
to allow a commit with an empty message.  This is analogous to the
existing --allow-empty option which allows a commit that records
no changes.  As these are mainly for interoperating with foreign SCM
systems, and are not meant for normal use, ensure that "git commit -h"
does not talk about them.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-07 15:22:57 -07:00
Junio C Hamano ae722b4e27 Merge branch 'sb/fmt-merge-msg'
* sb/fmt-merge-msg:
  fmt-merge-msg: hide summary option
  fmt-merge-msg: remove custom string_list implementation
  string-list: add unsorted_string_list_lookup()
  fmt-merge-msg: use pretty.c routines
  t6200: test fmt-merge-msg more
  t6200: modernize with test_tick
  fmt-merge-msg: be quiet if nothing to merge
2010-04-06 14:50:46 -07:00
Junio C Hamano f9bdf9b210 Merge branch 'ef/maint-empty-commit-log'
* ef/maint-empty-commit-log:
  rev-list: fix --pretty=oneline with empty message
2010-04-06 14:50:46 -07:00
Chris Webb d511bd330d whitespace: replumb ws_fix_copy to take a strbuf *dst instead of char *dst
To implement --whitespace=fix for tab-in-indent, we have to allow for the
possibility that whitespace can increase in size when it is fixed, expanding
tabs to to multiple spaces in the initial indent.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-04 14:21:54 -07:00
Jonathan Nieder 9974e290e7 Teach mailinfo %< as an alternative scissors mark
Handle perforations found “in the wild” more robustly by recognizing
“%<” as an alternative scissors mark.

This feature is only meant to support old habits.  Discourage new use
of the percent-based version by only documenting the 8< symbol so new
users’ perforations can still be recognized by old versions of Git.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-04 10:17:55 -07:00
Junio C Hamano aa4beff4b5 Merge branch 'mg/use-default-abbrev-length-in-rev-list'
* mg/use-default-abbrev-length-in-rev-list:
  rev-list: use default abbrev length when abbrev-commit is in effect
2010-04-03 12:28:42 -07:00
Junio C Hamano 16b8a3e4b9 Merge branch 'jn/merge-diff3-label'
* jn/merge-diff3-label:
  merge-recursive: add a label for ancestor
  cherry-pick, revert: add a label for ancestor
  revert: clarify label on conflict hunks
  compat: add mempcpy()
  checkout -m --conflict=diff3: add a label for ancestor
  merge_trees(): add ancestor label parameter for diff3-style output
  merge_file(): add comment explaining behavior wrt conflict style
  checkout --conflict=diff3: add a label for ancestor
  ll_merge(): add ancestor label parameter for diff3-style output
  merge-file --diff3: add a label for ancestor
  xdl_merge(): move file1 and file2 labels to xmparam structure
  xdl_merge(): add optional ancestor label to diff3-style output
  tests: document cherry-pick behavior in face of conflicts
  tests: document format of conflicts from checkout -m

Conflicts:
	builtin/revert.c
2010-04-03 12:28:41 -07:00
Junio C Hamano 40a56f45bc Merge branch 'ef/cherry-abbrev'
* ef/cherry-abbrev:
  ls: remove redundant logic
  cherry: support --abbrev option
2010-04-03 12:28:40 -07:00
Junio C Hamano 07b838f087 Merge branch 'rs/threaded-grep-context'
* rs/threaded-grep-context:
  grep: enable threading for context line printing

Conflicts:
	grep.c
2010-04-03 12:28:39 -07:00
Markus Heidelberg 4bb6644d03 git status: refresh the index if possible
This was already the case before commit 9e4b7ab6 (git status: not
"commit --dry-run" anymore, 2009-08-15) with the difference that it died
at failure.
It got lost during the new implementation of "git status", which was
meant to only change behaviour when invoked with arguments.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-02 21:25:59 -07:00
Markus Heidelberg 1f2362a944 builtin/commit: remove unnecessary variable definition
The file descriptor is already defined at the beginning of the function.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-02 11:38:00 -07:00
Markus Heidelberg 7327623526 builtin/commit: fix duplicated sentence in a comment
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-02 11:37:03 -07:00
Jeff King 40d52ff77b make commit_tree a library function
Until now, this has been part of the commit-tree builtin.
However, it is already used by other builtins (like commit,
merge, and notes), and it would be useful to access it from
library code.

The check_valid helper has to come along, too, but is given
a more library-ish name of "assert_sha1_type".

Otherwise, the code is unchanged. There are still a few
rough edges for a library function, like printing the utf8
warning to stderr, but we can address those if and when they
come up as inappropriate.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-01 23:53:54 -07:00
Christian Couder 91e5259896 revert: add "--strategy" option to choose merge strategy
This patch makes it possible to use a different merge strategy when
cherry-picking. This is usefull mainly for debugging purposes as it
allows to see if some failures are caused by the merge strategy used or
not.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-01 11:14:11 -07:00
Christian Couder c674d05273 merge: make function try_merge_command non static
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-01 11:14:10 -07:00
Christian Couder 3f9083cde3 merge: refactor code that calls "git merge-STRATEGY"
In the try_merge_strategy() function, when the strategy is "recursive"
or "subtree", the merge_recursive() function is called.
Otherwise we launch a "git merge-STRATEGY" process.

To make it possible to reuse code that launches a "git merge-STRATEGY"
process, this patch refactors this code into a new try_merge_command()
function.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-01 11:14:10 -07:00
Christian Couder ae8c79fd8f revert: refactor merge recursive code into its own function
The code that is used to do a recursive merge is extracted from
the revert_or_cherry_pick() function and put into a new
do_recursive_merge() function.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-01 11:14:10 -07:00
Christian Couder bc84a7fbac revert: use strbuf to refactor the code that writes the merge message
The code in this commit was written by Stephan Beyer for the sequencer
GSoC project:

    git://repo.or.cz/git/sbeyer.git

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-01 11:14:09 -07:00
Junio C Hamano 890a13a452 Sync with 1.7.0.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-31 15:14:27 -07:00
Sverre Rabbelier df61c88979 clone: also configure url for bare clones
Without this the 'origin' remote would not be configured, so when
calling remote_get with 'origin' as argument we would get an
unconfigured remote.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-31 09:37:26 -07:00
Sverre Rabbelier 766ac6a6ba clone: pass the remote name to remote_get
Currently when using a remote helper to clone a repository, the
remote helper will be passed the url of the target repository as
first argument (which represents the name of the remote). This name
is extracted from transport->remote->name, which is set by
builtin/clone.c when it calls remote_get with argv[0] as argument.

Fix this by passing the name remote will be set up as instead.

However, setup_reference calls remote_get before the remote is
added to the config file. This will result in an improperly
configured remote (in memory) if later on remote_get is called
with an argument that is not equal to the initial remote_get call
in setup_reference. Fix this by delaying the remote_get call until
after the remote has been added to the config file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-31 09:37:26 -07:00
Junio C Hamano 87b3c0117a Merge branch 'maint'
* maint:
  format-patch: Squelch 'fatal: Not a range." error
2010-03-29 21:29:24 -07:00
Junio C Hamano 99f5b0845a Merge branch 'cc/cherry-pick-ff'
* cc/cherry-pick-ff:
  revert: fix tiny memory leak in cherry-pick --ff
  rebase -i: use new --ff cherry-pick option
  Documentation: describe new cherry-pick --ff option
  cherry-pick: add tests for new --ff option
  revert: add --ff option to allow fast forward when cherry-picking
  builtin/merge: make checkout_fast_forward() non static
  parse-options: add parse_options_concat() to concat options
2010-03-28 21:52:28 -07:00
Junio C Hamano 3b37d9c17e Merge branch 'sb/notes-parse-opt'
* sb/notes-parse-opt:
  notes: rework subcommands and parse options

Conflicts:
	builtin/notes.c
2010-03-28 21:52:28 -07:00
Junio C Hamano faf752693a Merge branch 'maint'
* maint:
  t9350: fix careless use of "cd"
  difftool: Fix '--gui' when diff.guitool is unconfigured
  fast-export: don't segfault when marks file cannot be opened
2010-03-28 17:42:58 -07:00
Peter Collingbourne 80d706afed Introduce remove_or_warn function
This patch introduces the remove_or_warn function which is a
generalised version of the {unlink,rmdir}_or_warn functions.  It takes
an additional parameter indicating the mode of the file to be removed.

The patch also modifies certain functions to use remove_or_warn
where appropriate, and adds a test case for a bug fixed by the use
of remove_or_warn.

Signed-off-by: Peter Collingbourne <peter@pcc.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-28 09:53:04 -07:00
Alex Riesen 8b1fa77867 Allow passing of configuration parameters in the command line
The values passed this way will override whatever is defined
in the config files.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-28 09:48:25 -07:00
Stephen Boyd 63e6715087 fmt-merge-msg: hide summary option
The --summary command line option has been deprecated in favor of --log.
Hide the option from the help message to further discourage the use of
this option.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-24 19:45:31 -07:00
Stephen Boyd fcb243f7db fmt-merge-msg: remove custom string_list implementation
This command uses a custom version of string list when it could
just as easily use the string_list API. Convert it to use string_list
and reduce the code size a bit.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-24 19:42:10 -07:00
Stephen Boyd 15cb500786 fmt-merge-msg: use pretty.c routines
This command duplicates functionality of the '%s' pretty format.
Simplify the code a bit by using the pretty printing routine
instead of open-coding it here.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-24 19:40:43 -07:00
Stephen Boyd 419fe5bc86 fmt-merge-msg: be quiet if nothing to merge
When FETCH_HEAD contains only 'not-for-merge' entries fmt-merge-msg
still outputs "Merge" (and if the branch isn't master " into <branch>").
In this case fmt-merge-msg is outputting junk and should really just
be quiet. Fix it.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-24 19:39:40 -07:00
Junio C Hamano a86ed83cce Merge branch 'tr/notes-display'
* tr/notes-display:
  git-notes(1): add a section about the meaning of history
  notes: track whether notes_trees were changed at all
  notes: add shorthand --ref to override GIT_NOTES_REF
  commit --amend: copy notes to the new commit
  rebase: support automatic notes copying
  notes: implement helpers needed for note copying during rewrite
  notes: implement 'git notes copy --stdin'
  rebase -i: invoke post-rewrite hook
  rebase: invoke post-rewrite hook
  commit --amend: invoke post-rewrite hook
  Documentation: document post-rewrite hook
  Support showing notes from more than one notes tree
  test-lib: unset GIT_NOTES_REF to stop it from influencing tests

Conflicts:
	git-am.sh
	refs.c
2010-03-24 16:26:43 -07:00
Junio C Hamano 797d44343c Merge branch 'pb/log-first-parent-p-m'
* pb/log-first-parent-p-m:
  show --first-parent/-m: do not default to --cc
  show -c: show patch text
  revision: introduce setup_revision_opt
  t4013: add tests for log -p -m --first-parent
  git log -p -m: document -m and honor --first-parent
2010-03-24 16:25:39 -07:00
Erick Mattos 9db5ebf402 git checkout: create unparented branch by --orphan
Similar to -b, --orphan creates a new branch, but it starts without any
commit.  After running "git checkout --orphan newbranch", you are on a
new branch "newbranch", and the first commit you create from this state
will start a new history without any ancestry.

"git checkout --orphan" keeps the index and the working tree files
intact in order to make it convenient for creating a new history whose
trees resemble the ones from the original branch.

When creating a branch whose trees have no resemblance to the ones from
the original branch, it may be easier to start work on the new branch by
untracking and removing all working tree files that came from the
original branch, by running a 'git rm -rf .' immediately after running
"checkout --orphan".

Signed-off-by: Erick Mattos <erick.mattos@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-21 16:43:30 -07:00
Erik Faye-Lund 531e758d9c ls: remove redundant logic
find_unique_abbrev() already returns the full SHA-1 if abbrev = 0,
so we can remove the logic that avoids the call.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-21 16:23:44 -07:00
Erik Faye-Lund 28a53178fc cherry: support --abbrev option
Switch to parse-options API while we're at it.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-21 16:23:40 -07:00
Jonathan Nieder bf975d379d cherry-pick, revert: add a label for ancestor
When writing conflict hunks in ‘diff3 -m’ format, also add a label to
the common ancestor.  Especially in a cherry-pick, it is not immediately
obvious without such a label what the common ancestor represents.

git rerere does not have trouble parsing the new output and its preimage
ids are unchanged since it includes its own code for recreating conflict
hunks.  No other code in git parses conflict hunks.

Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20 20:36:11 -07:00
Jonathan Nieder d68565402a revert: clarify label on conflict hunks
When reverting a commit, the commit being merged is not the commit
to revert itself but its parent.  Add “parent of” to the conflict
hunk label to make this more clear.

The conflict hunk labels are all pieces of a single string written in
the new get_message() function.  Avoid some complication by using
mempcpy to advance a pointer as the result is written.

Also free the corresponding temporary buffer (it was leaked before).
This is not important because it is a small one-time allocation.  It
would become a memory leak if unnoticed when libifying revert.

This patch uses calls to strlen() instead of integer constants in some
places.  GCC will compute the length at compile time; I am not sure
about other compilers, but this is not performance-critical anyway.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20 20:36:11 -07:00
Jonathan Nieder c4151629e7 checkout -m --conflict=diff3: add a label for ancestor
git checkout --merge --conflict=diff3 can be used to present conflict
hunks including text from the common ancestor.  The added information
is helpful for resolving a merge by hand, and merge tools tend to
understand it because it is very similar to what ‘diff3 -m’ produces.

Unlike current git, diff3 -m includes a label for the merge base on
the ||||||| line, and unfortunately, some tools cannot parse the
conflict hunks without it.  Humans can benefit from a cue when
learning to interpreting the format, too.  Mark the start of the text
from the old branch with a label based on the branch’s name.

git rerere does not have trouble parsing this output and its preimage
ids are unchanged since it includes its own code for recreating
conflict hunks.  No other code in git tries to parse conflict hunks.

Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20 20:36:11 -07:00
Jonathan Nieder f0531a2937 checkout --conflict=diff3: add a label for ancestor
git checkout --conflict=diff3 can be used to present conflicts hunks
including text from the common ancestor:

	<<<<<<< ours
	ourside
	|||||||
	original
	=======
	theirside
	>>>>>>> theirs

The added information is helpful for resolving a merge by hand, and
merge tools can usually understand it without trouble because it looks
like output from ‘diff3 -m’.

diff3 includes a label for the merge base on the ||||||| line, and it
seems some tools (for example, Emacs 22’s smerge-mode) cannot parse
conflict hunks without such a label.  Humans could use help in
interpreting the output, too.  So change the marker for the start of the
text from the common ancestor to include the label “base”.

git rerere’s conflict identifiers are not affected: to parse conflict
hunks, rerere looks for whitespace after the ||||||| marker rather
than a newline, and to compute preimage ids, rerere has its own code
for creating conflict hunks.  No other code in git tries to parse
conflict hunks.

Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20 20:36:11 -07:00
Jonathan Nieder f01de62e45 ll_merge(): add ancestor label parameter for diff3-style output
Commands using the ll_merge() function will present conflict hunks
imitating ‘diff3 -m’ output if the merge.conflictstyle configuration
option is set appropriately.  Unlike ‘diff3 -m’, the output does not
include a label for the merge base on the ||||||| line of the output,
and some tools misparse the conflict hunks without that.

Add a new ancestor_label parameter to ll_merge() to give callers the
power to rectify this situation.  If ancestor_label is NULL, the output
format is unchanged.  All callers pass NULL for now.

Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20 20:36:11 -07:00
Jonathan Nieder 4bb0936206 merge-file --diff3: add a label for ancestor
git merge-file --diff3 can be used to present conflicts hunks
including text from the common ancestor.

The added information is helpful for resolving a merge by hand, and
merge tools can usually grok it because it looks like output from
diff3 -m.  However, ‘diff3’ includes a label for the merge base on the
||||||| line and some tools cannot parse conflict hunks without such a
label.  Write the base-name as passed in a -L option (or the name of
the ancestor file by default) on that line.

git rerere will not have trouble parsing this output, since instead of
looking for a newline, it looks for whitespace after the |||||||
marker.  Since rerere includes its own code for recreating conflict
hunks, conflict identifiers are unaffected.  No other code in git tries
to parse conflict hunks.

Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20 20:36:11 -07:00
Jonathan Nieder a4b5e91c49 xdl_merge(): move file1 and file2 labels to xmparam structure
The labels for the three participants in a potential conflict are all
optional arguments for the xdiff merge routine; if they are NULL, then
xdl_merge() can cope by omitting the labels from its output.  Move
them to the xmparam structure to allow new callers to save some
keystrokes where they are not needed.

This also has the virtue of making the xdiff merge interface more
similar to merge_trees, which might make it easier to learn.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20 20:36:10 -07:00
Junio C Hamano f1aa782a3b Merge branch 'ml/color-grep'
* ml/color-grep:
  grep: Colorize selected, context, and function lines
  grep: Colorize filename, line number, and separator
  Add GIT_COLOR_BOLD_* and GIT_COLOR_BG_*
2010-03-20 11:29:36 -07:00
Junio C Hamano 49559cad6c Merge branch 'cc/reset-keep'
* cc/reset-keep:
  Documentation: improve description of "git reset --keep"
  reset: disallow using --keep when there are unmerged entries
  reset: disallow "reset --keep" outside a work tree
  Documentation: reset: describe new "--keep" option
  reset: add test cases for "--keep" option
  reset: add option "--keep" to "git reset"
2010-03-20 11:29:35 -07:00
Junio C Hamano 31fbae0f81 Merge branch 'bg/apply-fix-blank-at-eof'
* bg/apply-fix-blank-at-eof:
  t3417: Add test cases for "rebase --whitespace=fix"
  t4124: Add additional tests of --whitespace=fix
  apply: Allow blank context lines to match beyond EOF
  apply: Remove the quick rejection test
  apply: Don't unnecessarily update line lengths in the preimage
2010-03-20 11:29:35 -07:00
Junio C Hamano 2bb76e139e Merge branch 'bw/union-merge-refactor'
* bw/union-merge-refactor:
  merge-file: add option to select union merge favor
  merge-file: add option to specify the marker size
  refactor merge flags into xmparam_t
  make union merge an xdl merge favor
2010-03-20 11:29:34 -07:00
Junio C Hamano 96203bb074 Merge branch 'maint'
* maint:
  Update draft release notes to 1.7.0.3
  fetch: Fix minor memory leak
  fetch: Future-proof initialization of a refspec on stack
  fetch: Check for a "^{}" suffix with suffixcmp()
  daemon: parse_host_and_port SIGSEGV if port is specified
  Makefile: Fix CDPATH problem
  pull: replace unnecessary sed invocation
2010-03-20 11:29:19 -07:00
René Scharfe 431d6e7bc8 grep: enable threading for context line printing
If context lines are to be printed, grep separates them with hunk marks
("--\n").  These marks are printed between matches from different files,
too.  They are not printed before the first file, though.

Threading was disabled when context line printing was enabled because
avoiding to print the mark before the first line was an unsolved
synchronisation problem.  This patch separates the code for printing
hunk marks for the threaded and the unthreaded case, allowing threading
to be turned on together with the common -ABC options.

->show_hunk_mark, which controls printing of hunk marks between files in
show_line(), is now set in grep_buffer_1(), but only if some results
have already been printed and threading is disabled.  The threaded case
is handled in work_done().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-15 15:26:35 -07:00
Junio C Hamano c24138bc55 Merge branch 'sd/format-patch-to'
* sd/format-patch-to:
  send-email: add --no-cc, --no-to, and --no-bcc
  format-patch: add --no-cc, --no-to, and --no-add-headers
  format-patch: use a string_list for headers
  Add 'git format-patch --to=' option and 'format.to' configuration variable.
2010-03-15 00:58:55 -07:00
Junio C Hamano 53997a30f8 Merge branch 'tc/transport-verbosity'
* tc/transport-verbosity:
  transport: update flags to be in running order
  fetch and pull: learn --progress
  push: learn --progress
  transport->progress: use flag authoritatively
  clone: support multiple levels of verbosity
  push: support multiple levels of verbosity
  fetch: refactor verbosity option handling into transport.[ch]
  Documentation/git-push: put --quiet before --verbose
  Documentation/git-pull: put verbosity options before merge/fetch ones
  Documentation/git-clone: mention progress in -v

Conflicts:
	transport.h
2010-03-15 00:58:42 -07:00
Junio C Hamano 66bce02ec4 Merge branch 'ld/push-porcelain'
* ld/push-porcelain:
  t5516: Use test_cmp when appropriate
  git-push: add tests for git push --porcelain
  git-push: make git push --porcelain print "Done"
  git-push: send "To <remoteurl>" messages to the standard output in --porcelain mode
  git-push: fix an advice message so it goes to stderr

Conflicts:
	transport.c
2010-03-15 00:58:24 -07:00
Junio C Hamano 2949151fe9 Merge branch 'jh/notes'
* jh/notes: (33 commits)
  Documentation: fix a few typos in git-notes.txt
  notes: fix malformed tree entry
  builtin-notes: Minor (mostly parse_options-related) fixes
  builtin-notes: Add "copy" subcommand for copying notes between objects
  builtin-notes: Misc. refactoring of argc and exit value handling
  builtin-notes: Add -c/-C options for reusing notes
  builtin-notes: Refactor handling of -F option to allow combining -m and -F
  builtin-notes: Deprecate the -m/-F options for "git notes edit"
  builtin-notes: Add "append" subcommand for appending to note objects
  builtin-notes: Add "add" subcommand for adding notes to objects
  builtin-notes: Add --message/--file aliases for -m/-F options
  builtin-notes: Add "list" subcommand for listing note objects
  Documentation: Generalize git-notes docs to 'objects' instead of 'commits'
  builtin-notes: Add "prune" subcommand for removing notes for missing objects
  Notes API: prune_notes(): Prune notes that belong to non-existing objects
  t3305: Verify that removing notes triggers automatic fanout consolidation
  builtin-notes: Add "remove" subcommand for removing existing notes
  Teach builtin-notes to remove empty notes
  Teach notes code to properly preserve non-notes in the notes tree
  t3305: Verify that adding many notes with git-notes triggers increased fanout
  ...

Conflicts:
	Makefile
2010-03-15 00:52:06 -07:00
Junio C Hamano 3a27f415df Merge branch 'maint'
* maint:
  don't use default revision if a rev was specified
  for_each_recent_reflog_ent(): use strbuf, fix offset handling
  t/Makefile: remove test artifacts upon "make clean"
  blame: fix indent of line numbers
2010-03-13 21:31:42 -08:00
Junio C Hamano 90a2bf9ca1 Merge branch 'sd/init-template'
* sd/init-template:
  wrap-for-bin: do not export an empty GIT_TEMPLATE_DIR
  t/t0001-init.sh: add test for 'init with init.templatedir set'
  init: having keywords without value is not a global error.
  Add a "TEMPLATE DIRECTORY" section to git-init[1].
  Add `init.templatedir` configuration variable.
2010-03-10 15:32:43 -08:00
Junio C Hamano c505a85015 Merge branch 'sh/am-keep-cr'
* sh/am-keep-cr:
  git-am: Add tests for `--keep-cr`, `--no-keep-cr` and `am.keepcr`
  git-am: Add am.keepcr and --no-keep-cr to override it
  git-am: Add command line parameter `--keep-cr` passing it to git-mailsplit
  documentation: 'git-mailsplit --keep-cr' is not hidden anymore
2010-03-10 15:32:34 -08:00
Junio C Hamano e25ccff140 Merge branch 'cp/add-u-pathspec'
* cp/add-u-pathspec:
  test for add with non-existent pathspec
  git add -u: die on unmatched pathspec
2010-03-10 15:32:02 -08:00
Junio C Hamano 2e0e8b68e3 Merge branch 'lt/deepen-builtin-source'
* lt/deepen-builtin-source:
  Move 'builtin-*' into a 'builtin/' subdirectory

Conflicts:
	Makefile
2010-03-10 15:25:18 -08:00
Linus Torvalds 81b50f3ce4 Move 'builtin-*' into a 'builtin/' subdirectory
This shrinks the top-level directory a bit, and makes it much more
pleasant to use auto-completion on the thing. Instead of

	[torvalds@nehalem git]$ em buil<tab>
	Display all 180 possibilities? (y or n)
	[torvalds@nehalem git]$ em builtin-sh
	builtin-shortlog.c     builtin-show-branch.c  builtin-show-ref.c
	builtin-shortlog.o     builtin-show-branch.o  builtin-show-ref.o
	[torvalds@nehalem git]$ em builtin-shor<tab>
	builtin-shortlog.c  builtin-shortlog.o
	[torvalds@nehalem git]$ em builtin-shortlog.c

you get

	[torvalds@nehalem git]$ em buil<tab>		[type]
	builtin/   builtin.h
	[torvalds@nehalem git]$ em builtin		[auto-completes to]
	[torvalds@nehalem git]$ em builtin/sh<tab>	[type]
	shortlog.c     shortlog.o     show-branch.c  show-branch.o  show-ref.c     show-ref.o
	[torvalds@nehalem git]$ em builtin/sho		[auto-completes to]
	[torvalds@nehalem git]$ em builtin/shor<tab>	[type]
	shortlog.c  shortlog.o
	[torvalds@nehalem git]$ em builtin/shortlog.c

which doesn't seem all that different, but not having that annoying
break in "Display all 180 possibilities?" is quite a relief.

NOTE! If you do this in a clean tree (no object files etc), or using an
editor that has auto-completion rules that ignores '*.o' files, you
won't see that annoying 'Display all 180 possibilities?' message - it
will just show the choices instead.  I think bash has some cut-off
around 100 choices or something.

So the reason I see this is that I'm using an odd editory, and thus
don't have the rules to cut down on auto-completion.  But you can
simulate that by using 'ls' instead, or something similar.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-22 14:29:41 -08:00