Commit Graph

15085 Commits

Author SHA1 Message Date
Daniel Barkalow
dc87183189 Only use GIT_CONFIG in "git config", not other programs
For everything other than using "git config" to read or write a
git-style config file that isn't the current repo's config file,
GIT_CONFIG was actively detrimental. Rather than argue over which
programs are important enough to have work anyway, just fix all of
them at the root.

Also removes GIT_LOCAL_CONFIG, which would only be useful for programs
that do want to use global git-specific config, but not the repo's own
git-specific config, and want to use some other, presumably
git-specific config. Despite being documented, I can't find any sign that
it was ever used.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-01 02:35:49 -07:00
Johannes Schindelin
be612c2318 Add another fast-import example, this time for .zip files
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-01 00:48:17 -07:00
Junio C Hamano
66037991d3 Merge branch 'maint'
* maint:
  doc/rev-parse: clarify reflog vs --until for specifying revisions
2008-06-30 00:44:19 -07:00
Brian Gernhardt
f9d800e207 Add test results directory to t/.gitignore
We don't need test results to be committed if we're fixing a test.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-30 00:36:39 -07:00
Jeff King
f3cb169bc9 fetch: give a hint to the user when local refs fail to update
There are basically two categories of update failures for
local refs:

  1. problems outside of git, like disk full, bad
     permissions, etc.

  2. D/F conflicts on tracking branch ref names

In either case, there should already have been an error
message. In case '1', hopefully enough information has
already been given that the user can fix it. In the case of
'2', we can hint that the user can clean up their tracking
branch area by using 'git remote prune'.

Note that we don't actually know _which_ case we have, so
the user will receive the hint in case 1, as well. In this
case the suggestion won't do any good, but hopefully the
user is smart enough to figure out that it's just a hint.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-29 23:47:41 -07:00
Jeff King
a0d2ceb276 doc/rev-parse: clarify reflog vs --until for specifying revisions
The rev-parse manpage introduces the branch@{date} syntax,
and mentions the reflog specifically. However, new users may
not be familiar with the distinction between the reflog and
the commit date, so let's help them out with a "you may be
interested in --until" pointer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-29 23:47:26 -07:00
Junio C Hamano
0e047bd14c Update draft release notes for 1.6.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-29 23:28:47 -07:00
jrnieder@uchicago.edu
bd870878f8 Documentation: don't assume git-sh-setup and git-parse-remote are in PATH
When git-parse-remote and git-sh-setup are not installed in
$(bindir) anymore, the shell script library won't be found on
user's $PATH in general.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-29 23:28:47 -07:00
Junio C Hamano
e46f9c8161 t9700: skip when Test::More is not available
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-29 23:28:44 -07:00
Johannes Schindelin
5b8063b5b0 clone: respect the settings in $HOME/.gitconfig and /etc/gitconfig
After initializing the config in the newly-created repository, we
need to unset GIT_CONFIG so that the global configs are read again.

Noticed by Pieter de Bie.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-29 23:16:32 -07:00
Brian Gernhardt
ab20fda992 Fix t4017-diff-retval for white-space from wc
Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-29 15:11:50 -07:00
Junio C Hamano
8e69d78be3 Merge branch 'maint'
* maint:
  git-svn: don't sanitize remote names in config
  git-svn: avoid filling up the disk with temp files.
  git cat-file: Fix memory leak in batch mode
  fix git config example syntax
  avoid off-by-one error in run_upload_archive
2008-06-28 21:08:35 -07:00
Eric Wong
7829f20f5b git-svn: don't sanitize remote names in config
The original sanitization code was just taken from the
remotes2config.sh shell script in contrib.

Credit to Avery Pennarun for noticing this mistake, and Junio
for clarifying the rules for config section names:

Junio C Hamano wrote in <7vfxr23s6m.fsf@gitster.siamese.dyndns.org>:

> In
>
> 	[foo "bar"] baz = value
>
> foo and baz must be config.c::iskeychar() (and baz must be isalpha()), but
> "bar" can be almost anything.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 20:55:45 -07:00
Olivier Marin
861d1af36a show_stats(): fix stats width calculation
Before this patch, name_width becomes negative or null for width values
less than 15 and name_width values greater than 25 (default: 50). This
leads to output random data.

This patch checks for minimal width and name_width values.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 20:55:26 -07:00
Olivier Marin
8813df9066 Documentation: remove {show,whatchanged}.difftree config options
This removes, from the documentation and the bash completion script, the
two config options that were introduced by the git-whatchanged.sh script
and lost in the C rewrite. Today, we can use aliases as an alternative.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 20:55:26 -07:00
Avery Pennarun
29c70e0b3e git-svn: avoid filling up the disk with temp files.
Commit ffe256f9ba ("git-svn: Speed up fetch")
introduced changes that create a temporary file for each object fetched by
svn.  These files should be deleted automatically, but perl apparently
doesn't do this until the process exits (or perhaps when its garbage
collector runs).

This means that on a large fetch, especially with lots of branches, we
sometimes fill up /tmp completely, which prevents the next temp file from
being written completely.  This is aggravated by the fact that a new temp
file is created for each updated file, even if that update produces a file
identical to one already in git.  Thus, it can happen even if there's lots
of disk space to store the finished repository.

We weren't adequately checking for write errors, so this would result in an
invalid file getting committed, which caused git-svn to fail later with an
invalid checksum.

This patch adds a check to syswrite() so similar problems don't lead to
corruption in the future.  It also unlink()'s each temp file explicitly
when we're done with it, so the disk doesn't need to fill up.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Tested-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 19:57:22 -07:00
Björn Steinbrink
5b8a94b1db git cat-file: Fix memory leak in batch mode
When run in batch mode, git cat-file never frees the memory for the blob
contents it is printing. This quickly adds up and causes git-svn to be
hardly usable for imports of large svn repos, because it uses cat-file in
batch mode and cat-file's memory usage easily reaches several hundred MB
without any good reason.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 19:50:56 -07:00
Thomas Rast
fa835cd572 git-send-email: prevent undefined variable warnings if no encryption is set
With the previous patch, not configuring any encryption (either on or
off) would leave $smtp_encryption undefined.  We simply set it to the
empty string in that case.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 16:49:33 -07:00
Joey Hess
762656e03e fix git config example syntax
git-config expects a space, not '=' between option and value.

Also, quote the value since it contains globs, which some shells will not
pass through unchanged, or will abort if the glob doesn't expand.

Signed-off-by: Joey Hess <joey@kitenet.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 13:43:22 -07:00
Jochen Voss
74d817cf8c avoid off-by-one error in run_upload_archive
Make sure that buf has enough space to store the trailing \0 of
the command line argument, too.

Signed-off-by: Jochen Voss <voss@seehuhn.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 13:43:21 -07:00
Lea Wiemann
935e247e8c GIT-VERSION-GEN: do not fail if a 'HEAD' file exists in the working copy
Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 10:53:11 -07:00
Johannes Schindelin
c14b9d1e33 Allow git-apply to recount the lines in a hunk (AKA recountdiff)
Sometimes, the easiest way to fix up a patch is to edit it directly, even
adding or deleting lines.  Now, many people are not as divine as certain
benevolent dictators as to update the hunk headers correctly at the first
try.

So teach the tool to do it for us.

[jc: with tests]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 01:19:42 -07:00
Johannes Schindelin
ef98c5cafb commit-tree: lift completely arbitrary limit of 16 parents
There is no really good reason to have a merge with more than 16
parents, but we have a history of giving our users rope.

Combined with the fact that there was no good reason for that
arbitrary limit in the first place, here is an all-too-easy to fix.

Kind of wished-for by Len Brown.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-27 23:36:59 -07:00
Dmitry Potapov
5b8e6f85f9 shrink git-shell by avoiding redundant dependencies
A lot of modules that have nothing to do with git-shell functionality
were linked in, bloating git-shell more than 8 times.

This patch cuts off redundant dependencies by:
1. providing stubs for three functions that make no sense for git-shell;
2. moving quote_path_fully from environment.c to quote.c to make the
   later self sufficient;
3. moving make_absolute_path into a new separate file.

The following numbers have been received with the default optimization
settings on master using GCC 4.1.2:

Before:
   text    data     bss     dec     hex filename
 143915    1348   93168  238431   3a35f git-shell

After:
   text    data     bss     dec     hex filename
  17670     788    8232   26690    6842 git-shell

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-27 23:22:00 -07:00
Christian Couder
2dce956e39 help: check early if we have a command, if not try a documentation topic
Before this patch, something like "git help tutorial" did not work,
people had to use "git help gittutorial" which is not very intuitive.

This patch uses the "is_git_command" function to test early if the
argument passed to "git help" is a git command, and if this is not the
case then we prefix the argument with "git" instead of "git-".

This way, things like "git help tutorial" or "git help glossary" will
work fine.

The little downside of this patch is that the "is_git_command" is a
little bit slow.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-27 23:21:45 -07:00
Don Zickus
7a07841c0b git-apply: handle a patch that touches the same path more than once better
When working with a lot of people who backport patches all day long, every
once in a while I get a patch that modifies the same file more than once
inside the same patch.  git-apply either fails if the second change relies
on the first change or silently drops the first change if the second change
is independent.

The silent part is the scary scenario for us.  Also this behaviour is
different from the patch-utils.

I have modified git-apply to create a table of the filenames of files it
modifies such that if a later patch chunk modifies a file in the table it
will buffer the previously changed file instead of reading the original file
from disk.

Logic has been put in to handle creations/deletions/renames/copies.  All the
relevant tests of git-apply succeed.

A new test has been added to cover the cases I addressed.

The fix is relatively straight-forward.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-27 17:01:02 -07:00
Jeff King
6315472eed fetch: report local storage errors in status table
Previously, if there was an error while storing a local
tracking ref, the low-level functions would report an error,
but fetch's status output wouldn't indicate any problem.
E.g., imagine you have an old "refs/remotes/origin/foo/bar" but
upstream has deleted "foo/bar" in favor of a new branch
"foo". You would get output like this:

  error: there are still refs under 'refs/remotes/origin/foo'
  From $url_of_repo
   * [new branch]      foo        -> origin/foo

With this patch, the output takes into account the status of
updating the local ref:

  error: there are still refs under 'refs/remotes/origin/foo'
  From $url_of_repo
   ! [new branch]      foo        -> origin/foo  (unable to update local ref)

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-27 16:22:51 -07:00
Johannes Schindelin
bc0c0d8156 clone: respect url.insteadOf setting in global configs
When we call "git clone" with a url that has a rewrite rule in either
$HOME/.gitconfig or /etc/gitconfig, the URL can be different from
what the command line expects it to be.

So, let's use the URL as the remote structure has it, not the literal
string from the command line.

Noticed by Pieter de Bie.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-27 16:21:19 -07:00
Junio C Hamano
d0658ec6fa Document the double-dash "rev -- path" disambiguator
This is a very well established command line convention that old residents
of the git mailing list knew by heart and nobody even thought about
documenting it explicitly, which was not very nice.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-27 16:18:10 -07:00
Junio C Hamano
03e2b630f0 Update sample pre-commit hook to use "diff --check"
Now "diff --check" can detect not just whitespace errors but also notices
leftover conflict marker lines, we can use it in the sample pre-commit
hook script.

These days the object layer knows about the empty tree object without
actually having one in the repository, so we can run the test even for the
initial commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 22:08:25 -07:00
Junio C Hamano
049540435f diff --check: detect leftover conflict markers
This teaches "diff --check" to detect and complain if the change
adds lines that look like leftover conflict markers.

We should be able to remove the old Perl script used in the sample
pre-commit hook and modernize the script with this facility.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 22:07:54 -07:00
Junio C Hamano
877f23ccb8 Teach "diff --check" about new blank lines at end
When a patch adds new blank lines at the end, "git apply --whitespace"
warns.  This teaches "diff --check" to do the same.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 22:07:26 -07:00
Junio C Hamano
1ba111d1d6 checkdiff: pass diff_options to the callback
This way, we could later use more information from the diff_options.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 22:06:09 -07:00
Ted Percival
d54467b8c3 Don't use dash commands (git-foo) in tutorial-2
Signed-off-by: Ted Percival <ted@midg3t.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 18:30:57 -07:00
Lea Wiemann
4c7ba956a3 test-lib.sh: show git init output when in verbose mode
Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 18:28:55 -07:00
Junio C Hamano
8f8841e9c8 check_and_emit_line(): rename and refactor
The function name was too bland and not explicit enough as to what it is
checking.  Split it into two, and call the one that checks if there is a
whitespace breakage "ws_check()", and call the other one that checks and
emits the line after color coding "ws_check_emit()".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 18:13:50 -07:00
Junio C Hamano
5ff10dd602 diff --check: explain why we do not care whether old side is binary
All other codepaths refrain from running textual diff when either the old
or the new side is binary, but this function only checks the new side.  I
was almost going to change it to check both, but that would be a bad
change.  Explain why to prevent future mistakes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 18:13:49 -07:00
Junio C Hamano
c0f5c69c68 Merge branch 'maint'
* maint:
  GIT 1.5.5.5
  GIT 1.5.4.6
  git-shell: accept "git foo" form
  diff --check: do not discard error status upon seeing a good line
2008-06-26 18:12:47 -07:00
Junio C Hamano
7ac749c96d Merge branch 'maint-1.5.5' into maint
* maint-1.5.5:
  GIT 1.5.5.5
  GIT 1.5.4.6
  git-shell: accept "git foo" form

Conflicts:

	GIT-VERSION-GEN
	RelNotes
2008-06-26 18:08:51 -07:00
Junio C Hamano
006f31d77f GIT 1.5.5.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 17:59:51 -07:00
Junio C Hamano
53b22a9e45 Merge branch 'maint-1.5.4' into maint-1.5.5
* maint-1.5.4:
  GIT 1.5.4.6
  git-shell: accept "git foo" form

Conflicts:

	GIT-VERSION-GEN
	RelNotes
2008-06-26 17:14:03 -07:00
Junio C Hamano
872354dcb3 GIT 1.5.4.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 17:11:21 -07:00
Junio C Hamano
bc7c73e29c git-shell: accept "git foo" form
This is a backport of 0a47dc110e
to 'maint' to be included in 1.5.6.2 so that older server side
can accept dashless form of request when clients are updated.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 16:51:23 -07:00
Junio C Hamano
18374e584c diff --check: do not discard error status upon seeing a good line
"git diff --check" should return non-zero when there was any whitespace
error but the code only paid attention to the error status of the last
new line in the patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 13:26:25 -07:00
Jeff King
d2bf48d2ad improve for-each-ref test script
Previously, we did a sanity check by doing for-each-ref
using each possible format atom. However, we never checked
the actual output produced by that atom, which recently let
an obvious bug go undetected for some time.

While we're at it, also clean up a few '!' into
test_must_fail.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 12:13:03 -07:00
Jing Xue
4c2d5d722c Add 'git-p4.allowSubmit' to git-p4
I'm working with a perforce repo using git-p4. There are some config
files which I need to change locally according to my environment. I'm
using a 'local' git branch to park these changes. And I want to avoid
accidentally checking them into p4 just by doing "git p4 submit"
mindlessly without realizing which branch I'm actually on.

This patch adds a new git config, 'git-p4.allowSubmit', which is a
whitelist of branch names. "git p4 submit" will only allow submissions
from local branches on the list. Useful for preventing inadvertently
submitting from a strictly local branch.

For backward compatibility, if this config is not set at all,
submissions from all branches are allowed.

Signed-off-by: Jing Xue <jingxue@digizenstudio.com>
Acked-By: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 12:10:42 -07:00
Junio C Hamano
de8d957034 Start draft release notes for 1.6.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 00:27:06 -07:00
Steffen Prohaska
14086b0a13 compat/pread.c: Add a forward declaration to fix a warning
read_in_full()'s is used in compat/pread.c.  read_in_full() is
declared in cache.h. But we can't include cache.h because too
many macros are defined there.  Using read_in_full() without
including cache.h is dangerous because we wouldn't recognize if
its prototyp changed.  gcc issues a warning about that.

This commit adds a forward declaration to git-compat-util.h.
git-compat-util.h is included by compat/pread.c _and_ cache.h.
Hence, changes in cache.h would be detected.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
2008-06-26 08:47:17 +02:00
Steffen Prohaska
cd800eecc2 Windows: Fix ntohl() related warnings about printf formatting
On Windows, ntohl() returns unsigned long.  On Unix it returns
uint32_t.  This makes choosing a suitable printf format string
hard.

This commit introduces a mingw specific helper function
git_ntohl() that casts to unsigned int before returning.  This
makes gcc's printf format check happy.  It should be safe because
we expect ntohl to use 32-bit numbers.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
2008-06-26 08:47:17 +02:00
Johannes Sixt
6fd6aec44f Windows: TMP and TEMP environment variables specify a temporary directory.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
2008-06-26 08:47:16 +02:00