git.git
12 years agoMerge branch 'jc/maint-branch-mergeoptions' into maint
Junio C Hamano [Mon, 16 May 2011 23:37:07 +0000 (16:37 -0700)]
Merge branch 'jc/maint-branch-mergeoptions' into maint

* jc/maint-branch-mergeoptions:
  merge: make branch.<name>.mergeoptions correctly override merge.<option>

Conflicts:
builtin/merge.c

12 years agoMerge branch 'jc/maint-add-p-overlapping-hunks' into maint
Junio C Hamano [Mon, 16 May 2011 23:36:46 +0000 (16:36 -0700)]
Merge branch 'jc/maint-add-p-overlapping-hunks' into maint

* jc/maint-add-p-overlapping-hunks:
  t3701: add-p-fix makes the last test to pass
  "add -p": work-around an old laziness that does not coalesce hunks
  add--interactive.perl: factor out repeated --recount option
  t3701: Editing a split hunk in an "add -p" session
  add -p: 'q' should really quit

12 years agoDocumentation/git-fsck.txt: fix typo: unreadable -> unreachable
Jim Meyering [Mon, 16 May 2011 18:23:35 +0000 (20:23 +0200)]
Documentation/git-fsck.txt: fix typo: unreadable -> unreachable

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUpdate draft release notes to 1.7.5.2
Junio C Hamano [Sun, 15 May 2011 23:11:55 +0000 (16:11 -0700)]
Update draft release notes to 1.7.5.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'cn/format-patch-quiet' into maint
Junio C Hamano [Sun, 15 May 2011 23:10:49 +0000 (16:10 -0700)]
Merge branch 'cn/format-patch-quiet' into maint

* cn/format-patch-quiet:
  format-patch: document --quiet option
  format-patch: don't pass on the --quiet flag

12 years agoMerge branch 'jm/mergetool-submodules' into maint
Junio C Hamano [Sun, 15 May 2011 22:57:16 +0000 (15:57 -0700)]
Merge branch 'jm/mergetool-submodules' into maint

* jm/mergetool-submodules:
  mergetool: Teach about submodules

12 years agoMerge branch 'jk/format-patch-quote-special-in-from' into maint
Junio C Hamano [Sun, 15 May 2011 22:56:44 +0000 (15:56 -0700)]
Merge branch 'jk/format-patch-quote-special-in-from' into maint

* jk/format-patch-quote-special-in-from:
  pretty: quote rfc822 specials in email addresses

12 years agoMerge branch 'vh/git-svn-doc' into maint
Junio C Hamano [Sun, 15 May 2011 22:52:40 +0000 (15:52 -0700)]
Merge branch 'vh/git-svn-doc' into maint

* vh/git-svn-doc:
  git-svn.txt: small typeface improvements
  git-svn.txt: move option descriptions
  git-svn.txt: fix usage of --add-author-from

12 years agogit_open_noatime(): drop unused parameter
Junio C Hamano [Sun, 15 May 2011 19:16:29 +0000 (12:16 -0700)]
git_open_noatime(): drop unused parameter

Since commit c793430 (Limit file descriptors used by packs, 2011-02-28),
the extra parameter added in f2e872aa (Work around EMFILE when there are
too many pack files, 2010-11-01) is not used anymore.

Remove it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
12 years agosha1_file: typofix
Junio C Hamano [Sun, 15 May 2011 19:16:03 +0000 (12:16 -0700)]
sha1_file: typofix

The number zero is spelled "zero", not "zer0".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoadd, merge, diff: do not use strcasecmp to compare config variable names
Jonathan Nieder [Sat, 14 May 2011 20:19:21 +0000 (15:19 -0500)]
add, merge, diff: do not use strcasecmp to compare config variable names

The config machinery already makes section and variable names
lowercase when parsing them, so using strcasecmp for comparison just
feels wasteful.  No noticeable change intended.

Noticed-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoPrepare for 1.7.5.2
Junio C Hamano [Fri, 13 May 2011 17:57:09 +0000 (10:57 -0700)]
Prepare for 1.7.5.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'aw/maint-rebase-i-p-no-ff' into maint
Junio C Hamano [Fri, 13 May 2011 17:45:21 +0000 (10:45 -0700)]
Merge branch 'aw/maint-rebase-i-p-no-ff' into maint

* aw/maint-rebase-i-p-no-ff:
  git-rebase--interactive.sh: preserve-merges fails on merges created with no-ff

13 years agoMerge branch 'js/blame-parsename' into maint
Junio C Hamano [Fri, 13 May 2011 17:45:00 +0000 (10:45 -0700)]
Merge branch 'js/blame-parsename' into maint

* js/blame-parsename:
  t/annotate-tests: Use echo & cat instead of sed
  blame: tolerate bogus e-mail addresses a bit better

13 years agoMerge branch 'gr/cvsimport-alternative-cvspass-location' into maint
Junio C Hamano [Fri, 13 May 2011 17:44:54 +0000 (10:44 -0700)]
Merge branch 'gr/cvsimport-alternative-cvspass-location' into maint

* gr/cvsimport-alternative-cvspass-location:
  Look for password in both CVS and CVSNT password files.

13 years agoMerge branch 'cj/p4merge' into maint
Junio C Hamano [Fri, 13 May 2011 17:44:46 +0000 (10:44 -0700)]
Merge branch 'cj/p4merge' into maint

* cj/p4merge:
  Pass empty file to p4merge where no base is suitable.

13 years agoMerge branch 'jk/merge-one-file-working-tree' into maint
Junio C Hamano [Fri, 13 May 2011 17:44:19 +0000 (10:44 -0700)]
Merge branch 'jk/merge-one-file-working-tree' into maint

* jk/merge-one-file-working-tree:
  merge-one-file: fix broken merges with alternate work trees
  add tests for merge-index / merge-one-file

13 years agoMerge branch 'jc/fix-diff-files-unmerged' into maint
Junio C Hamano [Fri, 13 May 2011 17:41:54 +0000 (10:41 -0700)]
Merge branch 'jc/fix-diff-files-unmerged' into maint

* jc/fix-diff-files-unmerged:
  diff-files: show unmerged entries correctly
  diff: remove often unused parameters from diff_unmerge()
  diff.c: return filepair from diff_unmerge()
  test: use $_z40 from test-lib

13 years agoMerge branch 'mz/maint-rename-unmerged' into maint
Junio C Hamano [Fri, 13 May 2011 17:41:24 +0000 (10:41 -0700)]
Merge branch 'mz/maint-rename-unmerged' into maint

* mz/maint-rename-unmerged:
  diffcore-rename: don't consider unmerged path as source

13 years agot5400: Fix a couple of typos
Johan Herland [Fri, 13 May 2011 16:43:29 +0000 (18:43 +0200)]
t5400: Fix a couple of typos

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3701: add-p-fix makes the last test to pass
Junio C Hamano [Sun, 8 May 2011 20:43:04 +0000 (13:43 -0700)]
t3701: add-p-fix makes the last test to pass

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge: make branch.<name>.mergeoptions correctly override merge.<option>
Junio C Hamano [Thu, 5 May 2011 00:42:51 +0000 (17:42 -0700)]
merge: make branch.<name>.mergeoptions correctly override merge.<option>

The parsing of the additional command line parameters supplied to
the branch.<name>.mergeoptions configuration variable was implemented
at the wrong stage.  If any merge-related variable came after we read
branch.<name>.mergeoptions, the earlier value was overwritten.

We should first read all the merge.* configuration, override them by
reading from branch.<name>.mergeoptions and then finally read from
the command line.

This patch should fix it, even though I now strongly suspect that
branch.<name>.mergeoptions that gives a single command line that
needs to be parsed was likely to be an ill-conceived idea to begin
with.  Sigh...

Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRemove duplicated "is a"
João Britto [Fri, 6 May 2011 04:16:17 +0000 (01:16 -0300)]
Remove duplicated "is a"

Signed-off-by: João Britto <jabcalves@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3701: fix here document
Junio C Hamano [Thu, 5 May 2011 18:28:52 +0000 (11:28 -0700)]
t3701: fix here document

A broken here-document was not caught because end of file is taken by
an implicit end of the here document (POSIX does not seem to say it is
an error to lack the delimiter), and everything in the test just turned
into a single "cat into a file".

Noticed-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-fast-import.txt: --relative-marks takes no parameter
Michael J Gruber [Thu, 5 May 2011 09:13:38 +0000 (11:13 +0200)]
git-fast-import.txt: --relative-marks takes no parameter

Remove spurious "=" after --relative-marks.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoshell: add missing initialization of argv0_path
Dima Sharov [Thu, 5 May 2011 06:40:17 +0000 (09:40 +0300)]
shell: add missing initialization of argv0_path

According to c6dfb39 (remote-curl: add missing initialization of
argv0_path, 2009-10-13), stand-alone programs (non-builtins)
must call git_extract_argv0_path(argv[0]) in order to help builds
that derive the installation prefix at runtime. Without this call,
the program segfaults (or raises an assertion failure).

Signed-off-by: Dima Sharov <git.avalakvista@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/annotate-tests: Use echo & cat instead of sed
Brian Gernhardt [Thu, 5 May 2011 04:43:37 +0000 (00:43 -0400)]
t/annotate-tests: Use echo & cat instead of sed

The use of the sed command "1i No robots allowed" caused the version
of sed in OS X to die with

   sed: 1: "1i "No robots allowed"\n": command i expects \ followed by
   text

Since this command was just trying to add a single line to the
beginning of the file, do the same with "echo" followed by "cat".

Unbreaks t8001 and t8002 on OS X 10.6.7

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.5.1 v1.7.5.1
Junio C Hamano [Wed, 4 May 2011 22:47:40 +0000 (15:47 -0700)]
Git 1.7.5.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jh/dirstat' into maint
Junio C Hamano [Wed, 4 May 2011 21:59:07 +0000 (14:59 -0700)]
Merge branch 'jh/dirstat' into maint

* jh/dirstat:
  --dirstat: In case of renames, use target filename instead of source filename
  Teach --dirstat not to completely ignore rearranged lines within a file
  --dirstat-by-file: Make it faster and more correct
  --dirstat: Describe non-obvious differences relative to --stat or regular diff

13 years agoMerge branch 'sp/maint-clear-postfields' into maint
Junio C Hamano [Wed, 4 May 2011 21:58:56 +0000 (14:58 -0700)]
Merge branch 'sp/maint-clear-postfields' into maint

* sp/maint-clear-postfields:
  http: clear POSTFIELDS when initializing a slot

13 years agoMerge branch 'jk/maint-stash-oob' into maint
Junio C Hamano [Wed, 4 May 2011 21:58:42 +0000 (14:58 -0700)]
Merge branch 'jk/maint-stash-oob' into maint

* jk/maint-stash-oob:
  stash: fix false positive in the invalid ref test.
  stash: fix accidental apply of non-existent stashes

Conflicts:
t/t3903-stash.sh

13 years agoMerge branch 'jk/maint-upload-pack-shallow' into maint
Junio C Hamano [Wed, 4 May 2011 21:58:13 +0000 (14:58 -0700)]
Merge branch 'jk/maint-upload-pack-shallow' into maint

* jk/maint-upload-pack-shallow:
  upload-pack: start pack-objects before async rev-list

13 years agoMerge branch 'dm/stash-k-i-p' into maint
Junio C Hamano [Wed, 4 May 2011 21:57:49 +0000 (14:57 -0700)]
Merge branch 'dm/stash-k-i-p' into maint

* dm/stash-k-i-p:
  stash: ensure --no-keep-index and --patch can be used in any order
  stash: add two more tests for --no-keep-index

13 years agoMerge branch 'jc/pack-objects-bigfile' into maint
Junio C Hamano [Wed, 4 May 2011 21:57:38 +0000 (14:57 -0700)]
Merge branch 'jc/pack-objects-bigfile' into maint

* jc/pack-objects-bigfile:
  Teach core.bigfilethreashold to pack-objects

13 years agoMerge branch 'mg/reflog-with-options' into maint
Junio C Hamano [Wed, 4 May 2011 21:57:33 +0000 (14:57 -0700)]
Merge branch 'mg/reflog-with-options' into maint

* mg/reflog-with-options:
  reflog: fix overriding of command line options
  t/t1411: test reflog with formats
  builtin/log.c: separate default and setup of cmd_log_init()

13 years agoMerge branch 'jk/stash-loosen-safety' into maint
Junio C Hamano [Wed, 4 May 2011 21:57:15 +0000 (14:57 -0700)]
Merge branch 'jk/stash-loosen-safety' into maint

* jk/stash-loosen-safety:
  stash: drop dirty worktree check on apply

13 years agoMerge branch 'ar/clean-rmdir-empty' into maint
Junio C Hamano [Wed, 4 May 2011 21:57:06 +0000 (14:57 -0700)]
Merge branch 'ar/clean-rmdir-empty' into maint

* ar/clean-rmdir-empty:
  clean: unreadable directory may still be rmdir-able if it is empty

13 years agoMerge branch 'mg/sha1-path-advise' into maint
Junio C Hamano [Wed, 4 May 2011 21:56:51 +0000 (14:56 -0700)]
Merge branch 'mg/sha1-path-advise' into maint

* mg/sha1-path-advise:
  sha1_name: Suggest commit:./file for path in subdir
  t1506: factor out test for "Did you mean..."

13 years agogit-add.txt: document 'add.ignoreErrors'
Valentin Haenel [Wed, 4 May 2011 19:58:17 +0000 (21:58 +0200)]
git-add.txt: document 'add.ignoreErrors'

Signed-off-by: Valentin Haenel <valentin.haenel@gmx.de>
Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoPass empty file to p4merge where no base is suitable.
Ciaran Jessup [Sun, 1 May 2011 22:16:02 +0000 (23:16 +0100)]
Pass empty file to p4merge where no base is suitable.

Modify the p4merge client command to pass a reference to an empty file
instead of the local file when no base revision available.

In the situation where a merge tries to add a file from one branch
into a branch that already contains that file (by name), p4merge
currently seems to have successfully automatically resolved the
'conflict' when it is opened (correctly if the files differed by
just whitespace for example) but leaves the save button disabled. This
means the user of the p4merge client cannot commit the resolved
changes back to disk and merely exits, leaving the original
(merge-conflicted) file intact on the disk.

Provide an empty base file to p4merge so that it leaves the save
button enabled.  This will allow saving of the auto-resolution to
disk.

Signed-off-by: Ciaran Jessup <ciaranj@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoLook for password in both CVS and CVSNT password files.
Guy Rouillier [Sun, 1 May 2011 05:33:52 +0000 (01:33 -0400)]
Look for password in both CVS and CVSNT password files.

In conn, if password is not passed on command line, look for a password
entry in both the CVS password file and the CVSNT password file.  If only
one file is found and the requested repository is in that file, or if both
files are found but the requested repository is found in only one file, use
the password from the single file containing the repository entry.  If both
files are found and the requested repository is found in both files, then
produce an error message.

The CVS password file separates tokens with a space character, while
the CVSNT password file separates tokens with an equal (=) character.
Add a sub find_password_entry that accepts the password file name
and a delimiter to eliminate code duplication.

Signed-off-by: Guy Rouillier <guyr@burntmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge-one-file: fix broken merges with alternate work trees
Jeff King [Fri, 29 Apr 2011 22:24:32 +0000 (18:24 -0400)]
merge-one-file: fix broken merges with alternate work trees

The merge-one-file tool predates the invention of
GIT_WORK_TREE. By the time GIT_WORK_TREE was invented, most
people were using the merge-recursive strategy, which
handles resolving internally. Therefore these features have
had very little testing together.

For the most part, merge-one-file just works with
GIT_WORK_TREE; most of its heavy lifting is done by plumbing
commands which do respect GIT_WORK_TREE properly. The one
exception is a shell redirection which touches the worktree
directly, writing results to the wrong place in the presence
of a GIT_WORK_TREE variable.

This means that merges won't even fail; they will silently
produce incorrect results, throwing out the entire "theirs"
side of files which need content-level merging!

This patch makes merge-one-file chdir to the toplevel of the
working tree (and exit if we don't have one). This most
closely matches the assumption made by the original script
(before separate work trees were invented), and matches what
happens when the script is called as part of a merge
strategy.

While we're at it, we'll also error-check the call to cat.
Merging a file in a subdirectory could in fact fail, as the
redirection relies on the "checkout-index" call just prior
to create leading directories. But we never noticed, since
we ignored the error return from running cat.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoadd tests for merge-index / merge-one-file
Jeff King [Fri, 29 Apr 2011 22:23:54 +0000 (18:23 -0400)]
add tests for merge-index / merge-one-file

There were no tests for either, except a brief use in
t1200-tutorial.

These tools are not used much these days, as most people
use the merge-recursive strategy, which handles everything
internally. However, they are used by the "octopus" and
"resolve" strategies, as well as any custom strategies
or merge scripts people have built around them.

For example, together with read-tree, they are the simplest
way to do a basic content-level merge without checking out
the entire repository contents beforehand.

This script adds a basic test of the tools to perform one
content-level merge. It also shows a failure of the tools to
work properly in the face of GIT_WORK_TREE or core.worktree.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years ago"add -p": work-around an old laziness that does not coalesce hunks
Junio C Hamano [Wed, 6 Apr 2011 21:20:57 +0000 (14:20 -0700)]
"add -p": work-around an old laziness that does not coalesce hunks

Since 0beee4c (git-add--interactive: remove hunk coalescing, 2008-07-02),
"git add--interactive" behaves lazily and passes overlapping hunks to the
underlying "git apply" without coalescing.  This was partially corrected
by 7a26e65 (its partial revert, 2009-05-16), but overlapping hunks are
still passed when the patch is edited.

Teach "git apply" the --allow-overlap option that disables a safety
feature that avoids misapplication of patches by not applying patches
to overlapping hunks, and pass this option form "add -p" codepath.

Do not even advertise the option, as this is merely a workaround, and the
correct fix is to make "add -p" correctly coalesce adjacent patch hunks.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoadd--interactive.perl: factor out repeated --recount option
Junio C Hamano [Wed, 6 Apr 2011 21:12:34 +0000 (14:12 -0700)]
add--interactive.perl: factor out repeated --recount option

Depending on the direction and the target of patch application, we would
need to pass --cached and --reverse to underlying "git apply".  Also we
only pass --check when we are not applying but just checking.

But we always pass --recount since 8cbd431 (git-add--interactive: replace
hunk recounting with apply --recount, 2008-07-02).  Instead of repeating
the same --recount over and over again, move it to a single place that
actually runs the command, namely, "run_git_apply" subroutine.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3701: Editing a split hunk in an "add -p" session
Junio C Hamano [Fri, 29 Apr 2011 19:41:16 +0000 (12:41 -0700)]
t3701: Editing a split hunk in an "add -p" session

Arnaud Lacombe reported that with the recent change to reject overlapping
hunks fed to "git apply", the edit mode of an "add -p" session that lazily
feeds overlapping hunks without coalescing adjacent ones claim that the
patch does not apply.  Expose the problem to be fixed.

Cf. http://thread.gmane.org/gmane.comp.version-control.git/170685/focus=171000

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoadd -p: 'q' should really quit
Junio C Hamano [Fri, 29 Apr 2011 22:12:32 +0000 (15:12 -0700)]
add -p: 'q' should really quit

The "quit" command was added in 9a7a1e0 (git add -p: new "quit" command at
the prompt, 2009-04-10) to allow the user to say that hunks other than
what have already been chosen are undesirable, and exit the interactive
loop immediately.  It forgot that there may be an undecided hunk before
the current one.  In such a case, the interactive loop still goes back to
the beginning.

Clear all the USE bit for undecided hunks and exit the loop.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoStart 1.7.5.1 maintenance track
Junio C Hamano [Fri, 29 Apr 2011 18:47:10 +0000 (11:47 -0700)]
Start 1.7.5.1 maintenance track

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'mg/x-years-12-months' into maint
Junio C Hamano [Fri, 29 Apr 2011 18:43:18 +0000 (11:43 -0700)]
Merge branch 'mg/x-years-12-months' into maint

* mg/x-years-12-months:
  date: avoid "X years, 12 months" in relative dates

13 years agogit-send-email: fix missing space in error message
Sylvain Rabot [Fri, 29 Apr 2011 18:23:24 +0000 (20:23 +0200)]
git-send-email: fix missing space in error message

When the command cannot make a connection to the SMTP server the error
message to diagnose the broken configuration is issued.  However, when an
optional smtp-server-port is given and needs to be reported, the message
lacked a space between "hello=<smtp-domain>" and "port=<smtp-server-port>".

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoblame: tolerate bogus e-mail addresses a bit better
Josh Stone [Thu, 21 Apr 2011 22:07:36 +0000 (15:07 -0700)]
blame: tolerate bogus e-mail addresses a bit better

The names and e-mails are sanitized by fmt_ident() when creating commits,
so that they do not contain "<" nor ">", and the "committer" and "author"
lines in the commit object will always be in the form:

    ("author" | "committer") name SP "<" email ">" SP timestamp SP zone

When parsing the email part out, the current code looks for SP starting
from the end of the email part, but the author could obfuscate the address
as "author at example dot com".

We should instead look for SP followed by "<", to match the logic of the
side that formats these lines.

Signed-off-by: Josh Stone <jistone@redhat.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-rebase--interactive.sh: preserve-merges fails on merges created with no-ff
Andrew Wong [Thu, 28 Apr 2011 04:35:55 +0000 (00:35 -0400)]
git-rebase--interactive.sh: preserve-merges fails on merges created with no-ff

'git rebase' uses 'git merge' to preserve merges (-p).  This preserves
the original merge commit correctly, except when the original merge
commit was created by 'git merge --no-ff'.  In this case, 'git rebase'
will fail to preserve the merge, because during 'git rebase', 'git
merge' will simply fast-forward and skip the commit.  For example:

               B
              / \
             A---M
            /
    ---o---O---P---Q

If we try to rebase M onto P, we lose the merge commit and this happens:

                 A---B
                /
    ---o---O---P---Q

To correct this, we simply do a "no fast-forward" on all merge commits
when rebasing.  Since by the time we decided to do a 'git merge' inside
'git rebase', it means there was a merge originally, so 'git merge'
should always create a merge commit regardless of what the merge
branches look like. This way, when rebase M onto P from the above
example, we get:

                   B
                  / \
                 A---M
                /
    ---o---O---P---Q

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agopretty: quote rfc822 specials in email addresses
Jeff King [Fri, 8 Apr 2011 22:40:36 +0000 (18:40 -0400)]
pretty: quote rfc822 specials in email addresses

If somebody has a name that includes an rfc822 special, we
will output it literally in the "From:" header. This is
usually OK, but certain characters (like ".") are supposed
to be enclosed in double-quotes in a mail header.

In practice, whether this matters may depend on your MUA.
Some MUAs will happily take in:

   From: Foo B. Bar <author@example.com>

without quotes, and properly quote the "." when they send
the actual mail.  Others may not, or may screw up harder
things like:

  From: Foo "The Baz" Bar <author@example.com>

For example, mutt will strip the quotes, thinking they are
actual syntactic rfc822 quotes.

So let's quote properly, and then (if necessary) we still
apply rfc2047 encoding on top of that, which should make all
MUAs happy.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-svn.txt: small typeface improvements
Valentin Haenel [Tue, 26 Apr 2011 11:34:19 +0000 (13:34 +0200)]
git-svn.txt: small typeface improvements

Mark subcommand names as 'subcommand' to make them stand out.

Signed-off-by: Valentin Haenel <valentin.haenel@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-svn.txt: move option descriptions
Valentin Haenel [Tue, 26 Apr 2011 11:34:18 +0000 (13:34 +0200)]
git-svn.txt: move option descriptions

The options '---use-log-author' and '--add-author-from' are applicable to other
subcommands except 'fetch' -- therefore move them from the 'fetch' section to
the more general 'options' section.

Signed-off-by: Valentin Haenel <valentin.haenel@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-svn.txt: fix usage of --add-author-from
Valentin Haenel [Mon, 25 Apr 2011 21:36:15 +0000 (23:36 +0200)]
git-svn.txt: fix usage of --add-author-from

The option '--add-author-from' is used in 'commit-diff', 'set-tree', and
'dcommit' subcommands.

Signed-off-by: Valentin Haenel <valentin.haenel@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agohttp: clear POSTFIELDS when initializing a slot
Junio C Hamano [Tue, 26 Apr 2011 15:04:49 +0000 (08:04 -0700)]
http: clear POSTFIELDS when initializing a slot

After posting a short request using CURLOPT_POSTFIELDS, if the slot
is reused for posting a large payload, the slot ends up having both
POSTFIELDS (which now points at a random garbage) and READFUNCTION,
in which case the curl library tries to use the stale POSTFIELDS.

Clear it as part of the general slot initialization in get_active_slot().

Heavylifting-by: Shawn Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn Pearce <spearce@spearce.org>
13 years agoGit 1.7.5 v1.7.5
Junio C Hamano [Sun, 24 Apr 2011 06:36:32 +0000 (23:36 -0700)]
Git 1.7.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff-files: show unmerged entries correctly
Junio C Hamano [Fri, 22 Apr 2011 23:19:27 +0000 (16:19 -0700)]
diff-files: show unmerged entries correctly

Earlier, e9c8409 (diff-index --cached --raw: show tree entry on the LHS
for unmerged entries., 2007-01-05) taught the command to show the object
name and the mode from the entry coming from the tree side when comparing
a tree with an unmerged index.

This is a belated companion patch that teaches diff-files to show the mode
from the entry coming from the working tree side, when comparing an
unmerged index and the working tree.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff: remove often unused parameters from diff_unmerge()
Junio C Hamano [Fri, 22 Apr 2011 23:05:58 +0000 (16:05 -0700)]
diff: remove often unused parameters from diff_unmerge()

e9c8409 (diff-index --cached --raw: show tree entry on the LHS for
unmerged entries., 2007-01-05) added a <mode, object name> pair as
parameters to this function, to store them in the pre-image side of an
unmerged file pair.  Now the function is fixed to return the filepair it
queued, we can make the caller on the special case codepath to do so.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff.c: return filepair from diff_unmerge()
Junio C Hamano [Fri, 22 Apr 2011 22:55:55 +0000 (15:55 -0700)]
diff.c: return filepair from diff_unmerge()

The underlying diff_queue() returns diff_filepair so that the caller can
further add information to it, and the helper function diff_unmerge()
utilizes the feature itself, but does not expose it to its callers, which
was kind of selfish.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotest: use $_z40 from test-lib
Junio C Hamano [Sun, 24 Apr 2011 05:34:13 +0000 (22:34 -0700)]
test: use $_z40 from test-lib

There is no need to duplicate the definition of $_z40 and $_x40 that
test-lib.sh supplies the test scripts.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodate: avoid "X years, 12 months" in relative dates
Michael J Gruber [Wed, 20 Apr 2011 09:12:11 +0000 (11:12 +0200)]
date: avoid "X years, 12 months" in relative dates

When relative dates are more than about a year ago, we start
writing them as "Y years, M months".  At the point where we
calculate Y and M, we have the time delta specified as a
number of days. We calculate these integers as:

  Y = days / 365
  M = (days % 365 + 15) / 30

This rounds days in the latter half of a month up to the
nearest month, so that day 16 is "1 month" (or day 381 is "1
year, 1 month").

We don't round the year at all, though, meaning we can end
up with "1 year, 12 months", which is silly; it should just
be "2 years".

Implement this differently with months of size

  onemonth = 365/12

so that

  totalmonths = (long)( (days + onemonth/2)/onemonth )
  years = totalmonths / 12
  months = totalmonths % 12

In order to do this without floats, we write the first formula as

  totalmonths = (days*12*2 + 365) / (365*2)

Tests and inspiration by Jeff King.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.5-rc3 v1.7.5-rc3
Junio C Hamano [Tue, 19 Apr 2011 18:51:00 +0000 (11:51 -0700)]
Git 1.7.5-rc3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoSync with 1.7.4.5
Junio C Hamano [Tue, 19 Apr 2011 18:49:13 +0000 (11:49 -0700)]
Sync with 1.7.4.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.4.5 v1.7.4.5
Junio C Hamano [Tue, 19 Apr 2011 18:45:38 +0000 (11:45 -0700)]
Git 1.7.4.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-svn.txt: Document --mergeinfo
Michael J Gruber [Tue, 19 Apr 2011 12:24:27 +0000 (14:24 +0200)]
git-svn.txt: Document --mergeinfo

6abd933 (git-svn: allow the mergeinfo property to be set, 2010-09-24)
introduced the --mergeinfo option. Document it.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRevert "run-command: prettify -D_FORTIFY_SOURCE workaround"
Junio C Hamano [Mon, 18 Apr 2011 21:14:53 +0000 (14:14 -0700)]
Revert "run-command: prettify -D_FORTIFY_SOURCE workaround"

This reverts commit ebec842773932e6f853acac70c80f84209b5f83e, which
somehow mistakenly thought that any non-zero return from write(2) is
an error.

13 years agoMerge branch 'maint'
Junio C Hamano [Thu, 14 Apr 2011 19:26:45 +0000 (12:26 -0700)]
Merge branch 'maint'

* maint:
  archive: document limitation of tar.umask config setting
  t3306,t5304: avoid clock skew issues
  git.txt: fix list continuation

13 years agoarchive: document limitation of tar.umask config setting
René Scharfe [Thu, 14 Apr 2011 18:04:57 +0000 (20:04 +0200)]
archive: document limitation of tar.umask config setting

The local value of the config variable tar.umask is not passed to the
other side with --remote.  We may want to change that, but for now just
document this fact.

Reported-by: Jacek Masiulaniec <jacek.masiulaniec@gmail.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3306,t5304: avoid clock skew issues
Michael J Gruber [Thu, 14 Apr 2011 17:38:13 +0000 (19:38 +0200)]
t3306,t5304: avoid clock skew issues

On systems where the local time and file modification time may be out of
sync (e.g. test directory on NFS) t3306 and t5305 can fail because prune
compares times such as "now" (client time) with file modification times
(server times for remote file systems). I.e., these are spurious test
failures.

Avoid this by setting the relevant modification times to the local time.

Noticed on a system with as little as 2s time skew.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit.txt: fix list continuation
Michael J Gruber [Thu, 14 Apr 2011 07:17:26 +0000 (09:17 +0200)]
git.txt: fix list continuation

Remove a spurious empty line which prevented asciidoc from recognizing a
list continuation mark ('+'), so that it does not get output literally any
more.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.5-rc2 v1.7.5-rc2
Junio C Hamano [Wed, 13 Apr 2011 21:01:03 +0000 (14:01 -0700)]
Git 1.7.5-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Wed, 13 Apr 2011 20:59:19 +0000 (13:59 -0700)]
Merge branch 'maint'

* maint:

13 years agoMerge branch 'jc/rev-list-options-fix' into maint
Junio C Hamano [Wed, 13 Apr 2011 20:56:52 +0000 (13:56 -0700)]
Merge branch 'jc/rev-list-options-fix' into maint

* jc/rev-list-options-fix:
  "log --cherry-pick" documentation regression fix

13 years agoMerge branch 'js/checkout-untracked-symlink' into maint
Junio C Hamano [Wed, 13 Apr 2011 20:55:53 +0000 (13:55 -0700)]
Merge branch 'js/checkout-untracked-symlink' into maint

* js/checkout-untracked-symlink:
  t2021: mark a test as fixed

13 years agomergetool: Teach about submodules
Jonathon Mah [Wed, 13 Apr 2011 10:00:48 +0000 (03:00 -0700)]
mergetool: Teach about submodules

When the index has conflicted submodules, mergetool used to mildly
clobber the module, renaming it to mymodule.BACKUP.nnnn, then failing to
copy it non-recursively.

Recognize submodules and offer a resolution instead:

  Submodule merge conflict for 'Shared':
    {local}: submodule commit ad9f12e3e6205381bf2163a793d1e596a9e211d0
    {remote}: submodule commit f5893fb70ec5646efcd9aa643c5136753ac89253
  Use (l)ocal or (r)emote, or (a)bort?

Selecting a commit will stage it, but not update the submodule (as git
does had there been no conflict). Type changes are also supported,
should the path be a submodule on one side, and a file, symlink,
directory, or deleted on the other.

Signed-off-by: Jonathon Mah <me@JonathonMah.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoremove doubled words, e.g., s/to to/to/, and fix related typos
Jim Meyering [Wed, 13 Apr 2011 15:39:40 +0000 (17:39 +0200)]
remove doubled words, e.g., s/to to/to/, and fix related typos

I found that some doubled words had snuck back into projects from which
I'd already removed them, so now there's a "syntax-check" makefile rule in
gnulib to help prevent recurrence.

Running the command below spotted a few in git, too:

  git ls-files | xargs perl -0777 -n \
    -e 'while (/\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt])\s+\1\b/gims)' \
    -e '{$n=($` =~ tr/\n/\n/ + 1); ($v=$&)=~s/\n/\\n/g;' \
    -e 'print "$ARGV:$n:$v\n"}'

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorevert: Hide '-r' option in default usage
Ramkumar Ramachandra [Sun, 10 Apr 2011 15:39:14 +0000 (21:09 +0530)]
revert: Hide '-r' option in default usage

The '-r' command-line option is a no-op provided only for backward
compatiblity since abd6970 (cherry-pick: make -r the default, 2006-10-05),
and somehow ended up surviving across reimplementation in C at 9509af6
(Make git-revert & git-cherry-pick a builtin, 2007-03-01) and another
rewrite of the command line parser at f810379 (Make builtin-revert.c use
parse_options, 2007-10-07).  We should have stopped advertising the option
long time ago.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoformat-patch: document --quiet option
Carlos Martín Nieto [Tue, 12 Apr 2011 15:51:37 +0000 (17:51 +0200)]
format-patch: document --quiet option

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoformat-patch: don't pass on the --quiet flag
Carlos Martín Nieto [Tue, 12 Apr 2011 15:35:38 +0000 (17:35 +0200)]
format-patch: don't pass on the --quiet flag

The --quiet flag is not meant to be passed on to the diff, as the user
always wants the patches to be produced so catch it and pass it to
reopen_stdout which decides whether to print the filename or not.

Noticed by Paul Gortmaker

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years ago--dirstat: In case of renames, use target filename instead of source filename
Johan Herland [Tue, 12 Apr 2011 09:24:34 +0000 (11:24 +0200)]
--dirstat: In case of renames, use target filename instead of source filename

This changes --dirstat analysis to count "damage" toward the target filename,
rather than the source filename. For renames within a directory, this won't
matter to the final output, but when moving files between diretories, the
output now lists the target directory rather than the source directory.

Signed-off-by: Johan Herland <johan@herland.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'js/checkout-untracked-symlink'
Junio C Hamano [Tue, 12 Apr 2011 07:05:50 +0000 (00:05 -0700)]
Merge branch 'js/checkout-untracked-symlink'

* js/checkout-untracked-symlink:
  t2021: mark a test as fixed

13 years agoMerge branch 'nd/init-gitdir'
Junio C Hamano [Tue, 12 Apr 2011 07:04:53 +0000 (00:04 -0700)]
Merge branch 'nd/init-gitdir'

* nd/init-gitdir:
  t0001: guard a new test with SYMLINKS prerequisite

13 years agot2021: mark a test as fixed
Johannes Sixt [Tue, 12 Apr 2011 06:41:19 +0000 (08:41 +0200)]
t2021: mark a test as fixed

The failure was fixed by the previous commit.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot0001: guard a new test with SYMLINKS prerequisite
Johannes Sixt [Tue, 12 Apr 2011 06:30:49 +0000 (08:30 +0200)]
t0001: guard a new test with SYMLINKS prerequisite

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoTeach --dirstat not to completely ignore rearranged lines within a file
Johan Herland [Sun, 10 Apr 2011 22:48:52 +0000 (00:48 +0200)]
Teach --dirstat not to completely ignore rearranged lines within a file

Currently, the --dirstat analysis ignores when lines within a file are
rearranged, because the "damage" calculated by show_dirstat() is 0.
However, if the object name has changed, we already know that there is
some damage, and it is unintuitive to claim there is _no_ damage.

Teach show_dirstat() to assign a minimum amount of damage (== 1) to
entries for which the analysis otherwise yields zero damage, to still
represent that these files are changed, instead of saying that there
is no change.

Also, skip --dirstat analysis when the object names are the same (e.g. for
a pure file rename).

Signed-off-by: Johan Herland <johan@herland.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMakefile: extract Q_() source strings as ngettext()
Ævar Arnfjörð Bjarmason [Sun, 10 Apr 2011 19:37:01 +0000 (19:37 +0000)]
Makefile: extract Q_() source strings as ngettext()

The Q_() wrapper added by 0c9ea33 (i18n: add stub Q_() wrapper for
ngettext, 2011-03-09) needs to be noticed by xgettext.

Add an appropriate --keyword option to the Makefile, so that "make pot"
would notice the strings in the plural form marked with the wrapper.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoi18n: avoid parenthesized string as array initializer
Ramsay Jones [Thu, 7 Apr 2011 18:41:48 +0000 (19:41 +0100)]
i18n: avoid parenthesized string as array initializer

The syntax

    static const char ignore_error[] = ("something");

is invalid C.  A parenthesized string is not allowed as an array
initializer.

Some compilers, for example GCC and MSVC, allow this syntax as an
extension, but it is not a portable construct.  tcc does not parse it, for
example.

Remove the parenthesis from the definition of the N_() macro to
fix this.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years ago--dirstat-by-file: Make it faster and more correct
Johan Herland [Sun, 10 Apr 2011 22:48:51 +0000 (00:48 +0200)]
--dirstat-by-file: Make it faster and more correct

Currently, when using --dirstat-by-file, it first does the full --dirstat
analysis (using diffcore_count_changes()), and then resets 'damage' to 1,
if any damage was found by diffcore_count_changes().

But --dirstat-by-file is not interested in the file damage per se. It only
cares if the file changed at all. In that sense it only cares if the blob
object for a file has changed. We therefore only need to compare the
object names of each file pair in the diff queue and we can skip the
entire --dirstat analysis and simply set 'damage' to 1 for each entry
where the object name has changed.

This makes --dirstat-by-file faster, and also bypasses --dirstat's practice
of ignoring rearranged lines within a file.

The patch also contains an added testcase verifying that --dirstat-by-file
now detects changes that only rearrange lines within a file.

Signed-off-by: Johan Herland <johan@herland.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years ago--dirstat: Describe non-obvious differences relative to --stat or regular diff
Johan Herland [Sun, 10 Apr 2011 22:48:50 +0000 (00:48 +0200)]
--dirstat: Describe non-obvious differences relative to --stat or regular diff

Also add a testcase documenting the current behavior.

Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge git://git.bogomips.org/git-svn
Junio C Hamano [Mon, 11 Apr 2011 16:34:19 +0000 (09:34 -0700)]
Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
  git-svn: Cache results of running the executable "git config"
  git-svn: Add a svn-remote.<name>.pushurl config key

13 years agoMerge git://git.kernel.org/pub/scm/gitk/gitk
Junio C Hamano [Mon, 11 Apr 2011 16:33:06 +0000 (09:33 -0700)]
Merge git://git.kernel.org/pub/scm/gitk/gitk

* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Update cherry-pick error message parsing
  gitk: Quote tag names in event bindings to avoid problems with % chars
  gitk: Allow user to control how much of the SHA1 ID gets auto-selected
  gitk: spelling fixes in Russian translation
  gitk: Take only numeric version components when computing $git_version

13 years agogit-svn: Cache results of running the executable "git config"
James Y Knight [Mon, 4 Apr 2011 19:09:08 +0000 (15:09 -0400)]
git-svn: Cache results of running the executable "git config"

Running programs is not cheap!

Signed-off-by: James Y Knight <jknight@itasoftware.com>
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
13 years agogit-svn: Add a svn-remote.<name>.pushurl config key
Alejandro R. Sedeño [Fri, 8 Apr 2011 14:57:54 +0000 (10:57 -0400)]
git-svn: Add a svn-remote.<name>.pushurl config key

Similar to the 'remote.<name>.pushurl' config key for git remotes,
'pushurl' is designed to be used in cases where 'url' points to an SVN
repository via a read-only transport, to provide an alternate
read/write transport. It is assumed that both keys point to the same
repository.

The 'pushurl' key is distinct from the 'commiturl' key in that
'commiturl' is a full svn path while 'pushurl' (like 'url') is a base
path. 'commiturl' takes precendece over 'pushurl' in cases where
either might be used.

The 'pushurl' is used by git-svn's dcommit and branch commands.

Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
Reviewed-by: James Y Knight <jknight@itasoftware.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
13 years agogitk: Update cherry-pick error message parsing
Anders Kaseorg [Wed, 19 Jan 2011 19:45:00 +0000 (14:45 -0500)]
gitk: Update cherry-pick error message parsing

Commit 981ff5c37ae20687c98d98c8689d5e89016026d2 changed the error
message from git cherry-pick from
    Automatic cherry-pick failed.  [...advice...]
to
    error: could not apply 7ab78c9... Do something neat.
    [...advice...]

Update gitk’s regex to match this, restoring the ability to launch git
citool to resolve conflicted cherry-picks.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Paul Mackerras <paulus@samba.org>
13 years agostash: ensure --no-keep-index and --patch can be used in any order
Dan McGee [Thu, 7 Apr 2011 17:04:20 +0000 (12:04 -0500)]
stash: ensure --no-keep-index and --patch can be used in any order

Don't assume one comes after the other on the command line. Use a
three-state variable to track and check its value accordingly.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agostash: add two more tests for --no-keep-index
Dan McGee [Thu, 7 Apr 2011 17:04:19 +0000 (12:04 -0500)]
stash: add two more tests for --no-keep-index

One of these passes just fine; the other one exposes a problem where
command line flag order matters for --no-keep-index and --patch
interaction.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-p4: replace each tab with 8 spaces for consistency
Andrew Garber [Thu, 7 Apr 2011 06:01:21 +0000 (02:01 -0400)]
git-p4: replace each tab with 8 spaces for consistency

Note that the majority of git-p4 uses spaces, not tabs, for indentation.
Consistent indentation is a good hygiene for Python scripts, and mixing
tabs and spaces in Python can lead to hard-to-find bugs.

Signed-off-by: Andrew Garber <andrew@andrewgarber.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoupload-pack: start pack-objects before async rev-list
Jeff King [Wed, 6 Apr 2011 21:33:33 +0000 (17:33 -0400)]
upload-pack: start pack-objects before async rev-list

In a pthread-enabled version of upload-pack, there's a race condition
that can cause a deadlock on the fflush(NULL) we call from run-command.

What happens is this:

  1. Upload-pack is informed we are doing a shallow clone.

  2. We call start_async() to spawn a thread that will generate rev-list
     results to feed to pack-objects. It gets a file descriptor to a
     pipe which will eventually hook to pack-objects.

  3. The rev-list thread uses fdopen to create a new output stream
     around the fd we gave it, called pack_pipe.

  4. The thread writes results to pack_pipe. Outside of our control,
     libc is doing locking on the stream. We keep writing until the OS
     pipe buffer is full, and then we block in write(), still holding
     the lock.

  5. The main thread now uses start_command to spawn pack-objects.
     Before forking, it calls fflush(NULL) to flush every stdio output
     buffer. It blocks trying to get the lock on pack_pipe.

And we have a deadlock. The thread will block until somebody starts
reading from the pipe. But nobody will read from the pipe until we
finish flushing to the pipe.

To fix this, we swap the start order: we start the
pack-objects reader first, and then the rev-list writer
after. Thus the problematic fflush(NULL) happens before we
even open the new file descriptor (and even if it didn't,
flushing should no longer block, as the reader at the end of
the pipe is now active).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>