Commit graph

18760 commits

Author SHA1 Message Date
Junio C Hamano ba7e81430a Merge branch 'maint-1.6.2' into maint-1.6.3
* maint-1.6.2:
  git-clone: add missing comma in --reference documentation
  clone: disconnect transport after fetching
2009-09-03 09:42:38 -07:00
Miklos Vajna 405923761a git-clone: add missing comma in --reference documentation
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-03 09:41:56 -07:00
Gerrit Pape d2feb01aa5 git-cvsserver: no longer use deprecated 'git-subcommand' commands
git-cvsserver still references git commands like 'git-config', which
is depcrecated.  This commit changes git-cvsserver to use the
'git subcommand' form.

Sylvain Beucler reported the problem through
 http://bugs.debian.org/536067

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-02 18:41:42 -07:00
Jeff King 12d4996622 clone: disconnect transport after fetching
The current code just leaves the transport in whatever state
it was in after performing the fetch.  For a non-empty clone
over the git protocol, the transport code already
disconnects at the end of the fetch.

But for an empty clone, we leave the connection hanging, and
eventually close the socket when clone exits. This causes
the remote upload-pack to complain "the remote end hung up
unexpectedly". While this message is harmless to the clone
itself, it is unnecessarily scary for a user to see and may
pollute git-daemon logs.

This patch just explicitly calls disconnect after we are
done with the remote end, which sends a flush packet to
upload-pack and cleanly disconnects, avoiding the error
message.

Other transports are unaffected or slightly improved:

 - for a non-empty repo over the git protocol, the second
   disconnect is a no-op (since we are no longer connected)

 - for "walker" transports (like HTTP or FTP), we actually
   free some used memory (which previously just sat until
   the clone process exits)

 - for "rsync", disconnect is always a no-op anyway

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-02 18:39:02 -07:00
Junio C Hamano 5e64650d93 Merge branch 'maint-1.6.2' into maint-1.6.3
* maint-1.6.2:
  Fix overridable written with an extra 'e'
  Documentation: git-archive: mark --format as optional in summary
  Round-down years in "years+months" relative date view

Conflicts:
	Documentation/git-archive.txt
2009-08-27 20:42:38 -07:00
Nanako Shiraishi 9319789804 Fix overridable written with an extra 'e'
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-27 20:41:48 -07:00
Junio C Hamano 891182f914 Merge branch 'maint-1.6.1' into maint-1.6.2
* maint-1.6.1:
  Documentation: git-archive: mark --format as optional in summary
2009-08-27 20:41:37 -07:00
Junio C Hamano 66fd74ea5d Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  Documentation: git-archive: mark --format as optional in summary
2009-08-27 20:41:31 -07:00
Wesley J. Landaker 82d97da30a Documentation: git-archive: mark --format as optional in summary
The --format option was made optional in 8ff21b1 (git-archive: make
tar the default format, 2007-04-09), but it was not marked as optional
in the summary. This trival patch just changes the summary to match
the rest of the documentation.

Signed-off-by: Wesley J. Landaker <wjl@icecavern.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-27 20:05:10 -07:00
Junio C Hamano a1eb73d917 Merge branch 'maint-1.5.6' into maint-1.6.0
* maint-1.5.6:
  revision traversal and pack: notice and die on missing commit
2009-08-27 20:03:35 -07:00
David Reiss 607a9e8aaa Round-down years in "years+months" relative date view
Previously, a commit from 1 year and 7 months ago would display as
"2 years, 7 months ago".

Signed-off-by: David Reiss <dreiss@facebook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-27 19:59:00 -07:00
Junio C Hamano 9e4a90ba19 Merge branch 'tr/maint-1.6.3-add-p-modeonly-fix' into maint-1.6.3
* tr/maint-1.6.3-add-p-modeonly-fix:
  add -p: do not attempt to coalesce mode changes
  git add -p: demonstrate failure when staging both mode and hunk
2009-08-26 11:22:00 -07:00
Thomas Rast 3d792161b1 add -p: do not attempt to coalesce mode changes
In 0392513 (add-interactive: refactor mode hunk handling, 2009-04-16),
we merged the interaction loops for mode changes and hunk staging.
This was fine at the time, because 0beee4c (git-add--interactive:
remove hunk coalescing, 2008-07-02) removed hunk coalescing.

However, in 7a26e65 (Revert "git-add--interactive: remove hunk
coalescing", 2009-05-16), we resurrected it.  Since then, the code
would attempt in vain to merge mode changes with diff hunks,
corrupting both in the process.

We add a check to the coalescing loop to ensure it only looks at diff
hunks, thus skipping mode changes.

Noticed-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-15 10:36:59 -07:00
Kirill Smelkov 87ca2eaade git add -p: demonstrate failure when staging both mode and hunk
When trying to stage changes to file which has also pending `chmod +x`,
`git add -p` produces lots of 'Use of uninitialized value ...' warnings
and fails to do the job:

    $ echo content >> file
    $ chmod +x file
    $ git add -p
    diff --git a/file b/file
    index e69de29..d95f3ad
    --- a/file
    +++ b/file
    old mode 100644
    new mode 100755
    Stage mode change [y,n,q,a,d,/,j,J,g,?]? y
    @@ -0,0 +1 @@
    +content
    Stage this hunk [y,n,q,a,d,/,K,g,e,?]? y
    Use of uninitialized value $o_ofs in addition (+) at .../git-add--interactive line 776.
    Use of uninitialized value $ofs in numeric le (<=) at .../git-add--interactive line 806.
    Use of uninitialized value $o0_ofs in concatenation (.) or string at .../git-add--interactive line 830.
    Use of uninitialized value $n0_ofs in concatenation (.) or string at .../git-add--interactive line 830.
    Use of uninitialized value $o_ofs in addition (+) at .../git-add--interactive line 776.
    fatal: corrupt patch at line 5
    diff --git a/file b/file
    index e69de29..d95f3ad
    --- a/file
    +++ b/file
    @@ -,0 + @@
    +content

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-15 10:36:29 -07:00
Ori Avtalion 57f6ec0290 Change mentions of "git programs" to "git commands"
Most of the docs and printouts refer to "commands" when discussing what
the end users call via the "git" top-level program. We should refer them
as "git programs" when we discuss the fact that the commands are
implemented as separate programs, but in other contexts, it is better to
use the term "git commands" consistently.

Signed-off-by: Ori Avtalion <ori@avtalion.name>
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-12 16:14:41 -07:00
Paul Bolle 22f1fb66be Documentation: merge: one <remote> is required
merge only requires one <remote>, so "<remote>..." should be used in the
synopsis (and not "<remote> <remote>...").

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-12 16:14:32 -07:00
Johan Herland 0b74f5dc3a help.c: give correct structure's size to memset()
These two structures are of the same type, but we'd better be consistent.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-12 16:14:31 -07:00
Štěpán Němec 75f492ace7 Fix typos in git-remote.txt and git-symbolic-ref.txt
Signed-off-by: Štěpán Němec <stepnem@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-10 19:05:00 -07:00
Junio C Hamano 39836a2e3c Merge branch 'maint-1.6.2' into maint-1.6.3
* maint-1.6.2:
  verify-pack -v: do not report "chain length 0"
  t5510: harden the way verify-pack is used
2009-08-07 20:44:15 -07:00
Junio C Hamano e72263a1f8 Merge branch 'maint-1.6.1' into maint-1.6.2
* maint-1.6.1:
  verify-pack -v: do not report "chain length 0"
  t5510: harden the way verify-pack is used
2009-08-07 20:44:09 -07:00
Junio C Hamano 0d5055665c Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  verify-pack -v: do not report "chain length 0"
  t5510: harden the way verify-pack is used
2009-08-07 20:44:02 -07:00
Junio C Hamano 262b04fa8d verify-pack -v: do not report "chain length 0"
When making a histogram of delta chain length in the pack, the program
collects number of objects whose delta depth exceeds the MAX_CHAIN limit
in histogram[0], and showed it as the number of items that exceeds the
limit correctly.  HOWEVER, it also showed the same number labeled as
"chain length = 0".

In fact, we are not showing the number of objects whose chain length is
zero, i.e. the base objects.  Correct this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-07 20:42:45 -07:00
Junio C Hamano 2e674a9d09 t5510: harden the way verify-pack is used
The test ignored the exit status from verify pack command, and also relied
on not seeing any delta chain statistics.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-07 20:42:45 -07:00
Matthieu Moy e77095e8b8 Better usage string for reflog.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-05 09:45:00 -07:00
Miklos Vajna b0c051d1a0 hg-to-git: don't import the unused popen2 module
Importing the popen2 module in Python-2.6 results in the
"DeprecationWarning: The popen2 module is deprecated.  Use the
subprocess module." message. The module itself isn't used in fact, so
just removing it solves the problem.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-04 15:20:45 -07:00
Erik Faye-Lund 69931b7183 send-email: remove debug trace
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
2009-08-04 15:20:35 -07:00
Björn Steinbrink ebdaae372b config: Keep inner whitespace verbatim
Configuration values are expected to be quoted when they have leading or
trailing whitespace, but inner whitespace should be kept verbatim even if
the value is not quoted. This is already documented in git-config(1), but
the code caused inner whitespace to be collapsed to a single space,
breaking, for example, clones from a path that has two consecutive spaces
in it, as future fetches would only see a single space.

Reported-by: John te Bokkel <tanj.tanj@gmail.com>
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-31 08:38:30 -07:00
Junio C Hamano e276f018f2 GIT 1.6.3.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-28 23:59:30 -07:00
Stephen Boyd 5c6d8bb290 config.txt: document add.ignore-errors
Use the description of "--ignore-errors" from git-add.txt as
inspiration.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-28 23:56:01 -07:00
Tom Grennan 33016c4913 request-pull: allow ls-remote to notice remote.$nickname.uploadpack
The location to pull from should be converted from the configured nickname
to URL in the message, but ls-remote should be fed the nickname so that
the command uses remote.$nickname.* variables, most notably "uploadpack".

Signed-off-by: Tom Grennan <tgrennan@redback.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-28 23:31:38 -07:00
Junio C Hamano 54bc13ce53 t8005: Nobody writes Russian in shift_jis
The second and third tests of this script expected that Russian strings
are converted between ISO-8859-5 and Shift_JIS in the "blame --porcelain"
format output correctly.

Sure, many platforms may convert between such a combination, but that is
only because one of the base character set of Shift_JIS, JIS X 0208,
defines codepoints for Russian characters (among others); I do not think
anybody uses Shift_JIS when seriously writing Russian, and it is perfectly
understandable if iconv() libraries on some platforms fail converting
between this combination, as it does not matter in reality.

This patch changes the test to verify Japanese strings are converted
correctly between EUC-JP and Shift_JIS in the same procedure.  The point
of the test is not about verifying the platform's iconv() library, but to
see if "git blame" makes correct iconv() library calls when it should.

We could instead use ISO-8859-5 and KOI8-R as the combination, because
they are both meant to represent Russian, in order to make this test
meaningful on more platforms, but we already use Shift_JIS vs EUC-JP
combinations to test other programs in our test suite, so this combination
is safer from the point of view of the portability.  Besides, I do not
read nor write Russian; sorry ;-)

This change allows tests to pass on my (friend's) Solaris 5.11 box.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-25 02:14:56 -07:00
Junio C Hamano 422a82f213 Fix severe breakage in "git-apply --whitespace=fix"
735c674 (Trailing whitespace and no newline fix, 2009-07-22) completely
broke --whitespace=fix, causing it to lose all the empty lines in a patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-25 01:29:20 -07:00
Junio C Hamano 01ae841ccf SunOS grep does not understand -C<n> nor -e
The first "grep -C1" test in t7002 does not pass on my SunOS-5.11-i86pc,
and that is not because our way to spawn external grep is broken, but
because the native grep does not understand -C<n>.

It turns out that Peff was also using this option himself because our
Makefile doesn't do that automatically.  Brandon Casey uses SUNWspro
compiler without having to set this, and it turns out that the compiler
does not define preprocessor macro __unix__ which made him always use the
built-in grep, never an external one.

Let's be more explicit and say that we do not use external grep on Suns.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-24 09:20:34 -07:00
Matthias Andree 96d69b5543 Fix export_marks() error handling.
- Don't leak one FILE * on error per export_marks() call. Found with
  cppcheck and reported by Martin Ettl.

- Abort the potentially long for(;idnums.size;) loop on write errors.

- Record error if fprintf() fails for reasons not required to set the
  stream error indicator, such as ENOMEM.

- Add a trailing full-stop to error message when fopen() fails.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-24 09:12:26 -07:00
Linus Torvalds 7e9ff00bbe git branch: clean up detached branch handling
Make the 'show detached branch info' a routine of its own.  And in the
process, avoid the object lookup that is unnecessary if the current
branch isn't detached.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-23 21:56:07 -07:00
Linus Torvalds 191d1ac435 git branch: avoid unnecessary object lookups
They can be expensive in the cold-cache case, so don't bother looking up
the commits for all branches unless we really need them for some reason.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-23 21:56:04 -07:00
Linus Torvalds e6e4a47ba1 git branch: fix performance problem
'git branch' looks at _all_ the refs, and verifies them.  Which means that
during cold-cache situations with a slow disk (and lots of tags, for
example) it can take several very annoying seconds (7.5s according to a
report by Carlos R.  Mafra).

This avoids most of it by simply doing the filtering before looking up
the commits, by using the "raw" version of for_each_ref.

Reported-by: Carlos R. Mafra <crmafra2@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-23 21:56:00 -07:00
Junio C Hamano eafb45265b do_one_ref(): null_sha1 check is not about broken ref
f8948e2 (remote prune: warn dangling symrefs, 2009-02-08) introduced a
more dangerous variant of for_each_ref() family that skips the check for
dangling refs, but it also made another unrelated check optional by
mistake.

The check to see if a ref points at 0{40} is not about brokenness, but is
about a possible future plan to represent a deleted ref by writing 40 "0"
in a loose ref when there is a stale version of the same ref already in
.git/packed-refs, so that we can implement deletion of a ref without
having to rewrite the packed refs file excluding the ref being deleted.

This check has to live outside of the conditional.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-22 23:07:05 -07:00
SZEDER Gábor 735c674416 Trailing whitespace and no newline fix
If a patch adds a new line to the end of a file and this line ends with
one trailing whitespace character and has no newline, then
'--whitespace=fix' currently does not remove that trailing whitespace.

This patch fixes this by removing the check for trailing whitespace at
the end of the line at a hardcoded offset which does not take the
eventual absence of newline into account.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-22 18:54:55 -07:00
Junio C Hamano b810cbbde9 diff --cc: a lost line at the beginning of the file is shown incorrectly
When combine-diff inspected the diff from one parent to the merge result,
it misinterpreted a header in the form @@ -l,k +0,0 @@.

This hunk header means that K lines were removed from the beginning of the
file, so the lost lines must be queued to the sline that represents the
first line of the merge result, but we incremented our pointer incorrectly
and ended up queuing it to the second line, which in turn made the lossage
appear _after_ the first line.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-22 15:38:22 -07:00
Junio C Hamano 55d5d5bab7 combine-diff.c: fix performance problem when folding common deleted lines
For a deleted line in a patch with the parent we are looking at, the
append_lost() function finds the same line among a run of lines that were
deleted from the same location by patches from parents we previously
checked.  This is so that patches with two parents

    @@ -1,4 +1,3 @@    @@ -1,4 +1,3 @@
     one                   one
    -two                  -two
     three                 three
    -quatro               -fyra
    +four                 +four

can be coalesced into this sequence, reusing one line that describes the
removal of "two" for both parents.

   @@@ -1,4 -1,4 +1,3 @@@
     one
   --two
     three
   - quatro
    -frya
   ++four

While reading the second patch (that removes "two" and then "fyra"), after
finding where removal of the "two" matches, we need to find existing
removal of "fyra" (if exists) in the removal list, but the match has to
happen after all the existing matches (in this case "two").  The code used
a naïve O(n^2) algorithm to compute this by scanning the whole removal
list over and over again.

This patch remembers where the next scan should be started in the existing
removal list to avoid this.

Noticed by Linus Torvalds.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-22 15:37:55 -07:00
Junio C Hamano 78d3b06e0f checkout -f: deal with a D/F conflict entry correctly
When we switch branches with "checkout -f", unpack_trees() feeds two
cache_entries to oneway_merge() function in its src[] array argument.  The
zeroth entry comes from the current index, and the first entry represents
what the merge result should be, taken from the tree recorded in the
commit we are switching to.

When we have a blob (either regular file or a symlink) in the index and in
the work tree at path "foo", and the switched-to tree has "foo/bar",
i.e. "foo" becomes a directory, src[0] is obviously that blob currently
registered at "foo".  Even though we do not have anything at "foo" in the
switched-to tree, src[1] is _not_ NULL in this case.

The unpack_trees() machinery places a special marker df_conflict_entry
to signal that no blob exists at "foo", but it will become a directory
that may have somthing underneath it (namely "foo/bar"), so a usual 3-way
merge can notice the situation.

But oneway_merge() codepath failed to notice this and passed the special
marker directly to merged_entry().  This happens to remove the "foo" in
the end because the df_conflict_entry does not have any name (hence the
"error" message) and its addition in add_index_entry() is rejected, but it
is wrong.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-07-18 16:57:30 -07:00
Brandon Casey b45a09c4b4 sha1_name.c: avoid unnecessary strbuf_release
When we fall back to a standard for_each_reflog_ent() after failing to find
the nth branch switch (or if we had a short reflog) with the call to
for_each_recent_reflog_ent(), we do not need to free the memory allocated
for our strbuf's since a strbuf_reset() will be performed in
grab_nth_branch_switch() before assigning to the entry.

Plus, the strbuf_release() negates the non-zero hint we initially gave to
strbuf_init() just above these lines.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-16 15:09:21 -07:00
Brandon Casey 9d33f7c22f refs.c: release file descriptor on error return
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-16 15:07:24 -07:00
Junio C Hamano 49902bd856 Merge branch 'cb/maint-fetch-refspec-wo-dst' into maint
* cb/maint-fetch-refspec-wo-dst:
  fetch: do not create ref from empty name
2009-07-08 09:52:25 -07:00
Junio C Hamano b13493b2b4 Merge branch 'cf/maint-remote-uploadpack-useconfig-fix' into maint
* cf/maint-remote-uploadpack-useconfig-fix:
  git-remote: fix missing .uploadpack usage for show command
2009-07-08 09:52:14 -07:00
Sitaram Chamarty 595b8dbfee Documentation: update description of shell aliases
Aliases that invoke shell commands start from the top-level directory,
but this was not documented.

Signed-off-by: Sitaram Chamarty <sitaramc@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-08 09:45:28 -07:00
Michal Marek 653a31c16a request-pull: really really disable pager
Earlier 476cc72 (request-pull: really disable pager, 2009-06-30)
tried to use the correct environment variable to disable paging
from multiple calls to "git log" and friends, but there was one
extra call to "git log" that was not covered by the trick.

Move the setting and exporting of GIT_PAGER much earlier in the
script to cover everybody.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-01 13:20:00 -07:00
René Scharfe d4c985653a attr: plug minor memory leak
Free the memory allocated for struct strbuf pathbuf when we're done.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 16:12:24 -07:00
Junio C Hamano 476cc72424 request-pull: really disable pager
ff06c74 (Improve request-pull to handle non-rebased branches, 2007-05-01)
attempted to disable pager when running subcommands in this script, but
with a wrong variable.  If GIT_PAGER is set, it takes precedence over
PAGER.

Noticed by Michal Marek.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 11:33:30 -07:00