1
0
mirror of https://github.com/git/git.git synced 2024-10-20 22:48:24 +02:00
Commit Graph

24353 Commits

Author SHA1 Message Date
Nguyễn Thái Ngọc Duy
9951d3b37e setup: clean up setup_discovered_git_dir()
If core.bare is true, discard the discovered worktree, move back to
original cwd.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 14:34:24 -08:00
Michael J Gruber
101662c225 t1020-subdirectory: test alias expansion in a subdirectory
Add a test for alias expansion in a subdirectory of the worktree.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy
1cd8031b2d setup: clean up setup_bare_git_dir()
work_tree_env argument is removed because this function does not need
it. GIT_WORK_TREE is only effective inside setup_explicit_git_dir.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy
e6aea2dba2 setup: limit get_git_work_tree()'s to explicit setup case only
get_git_work_tree() takes input as core.worktree, core.bare,
GIT_WORK_TREE and decides correct worktree setting.

Unfortunately it does not do its job well. core.worktree and
GIT_WORK_TREE should only be taken into account, if GIT_DIR is set
(which is handled by setup_explicit_git_dir). For other setup cases,
only core.bare matters.

Add a temporary variable setup_explicit to adjust get_git_work_tree()
behavior as such. This variable will be gone once setup_* rework is
done.

Also remove is_bare_repository_cfg check in set_git_work_tree() to
ease the rework. We are going to check for core.bare and core.worktree
early before setting worktree. For example, if core.bare is true, no
need to set worktree.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy
337e51cedf Use git_config_early() instead of git_config() during repo setup
When git_config() is called, either git_dir has already been set (by
$GIT_DIR env or set_git_dir()), or it will default git_dir to ".git".

git_config_early() gives setup functions more freedom because it does
not require git_dir. Give it a config path, it will happily examine
it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy
dbdf5854b2 Add git_config_early()
This version of git_config() will be used during repository setup.
As a repository is being set up, $GIT_DIR is not nailed down yet,
git_pathdup() should not be used to get $GIT_DIR/config.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 14:34:24 -08:00
Pete Wyckoff
a2b665de4b convert filter: supply path to external driver
Filtering to support keyword expansion may need the name of
the file being filtered.  In particular, to support p4 keywords
like

    $File: //depot/product/dir/script.sh $

the smudge filter needs to know the name of the file it is
smudging.

Allow "%f" in the custom filter command line specified in the
configuration.  This will be substituted by the filename
inside a single-quote pair to be passed to the shell.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 10:19:32 -08:00
Arnout Engelen
6cf6bb3e47 Improve error messages when temporary file creation fails
Before, when creating a temporary file failed, a generic 'Unable to create
temporary file' message was printed. In some cases this could lead to
confusion as to which directory should be checked for correct permissions etc.

This patch adds the template for the temporary filename to the error message,
converting it to an absolute path if needed. A test verifies that the template
is indeed printed when pointing to a nonexistent or unwritable directory.

A copy of the original template is made in case mkstemp clears the template.

Signed-off-by: Arnout Engelen <arnouten@bzzt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-21 19:51:17 -08:00
Junio C Hamano
853563d734 Merge branch 'maint'
* maint:
  t0050: fix printf format strings for portability
  t3419-*.sh: Fix arithmetic expansion syntax error
2010-12-21 14:45:28 -08:00
Junio C Hamano
6ae7a51a2e Merge branch 'ks/blame-worktree-textconv-cached'
* ks/blame-worktree-textconv-cached:
  fill_textconv(): Don't get/put cache if sha1 is not valid
  t/t8006: Demonstrate blame is broken when cachetextconv is on
2010-12-21 14:30:52 -08:00
Junio C Hamano
3f246b1cef Merge branch 'jk/t2107-now-passes'
* jk/t2107-now-passes:
  t2107: mark passing test as success
2010-12-21 14:30:47 -08:00
Junio C Hamano
f7d07cce82 Merge branch 'jk/maint-decorate-01-bool'
* jk/maint-decorate-01-bool:
  handle arbitrary ints in git_config_maybe_bool
2010-12-21 14:30:43 -08:00
Junio C Hamano
876e78f31d Merge branch 'tc/completion-reflog'
* tc/completion-reflog:
  bash completion: add basic support for git-reflog
2010-12-21 14:30:23 -08:00
Junio C Hamano
41cd7974b0 Merge branch 'nd/oneline-sha1-name-from-specific-ref'
* nd/oneline-sha1-name-from-specific-ref:
  get_sha1: handle special case $commit^{/}
  get_sha1: support $commit^{/regex} syntax
  get_sha1_oneline: make callers prepare the commit list to traverse
  get_sha1_oneline: fix lifespan rule of temp_commit_buffer variable
2010-12-21 14:30:19 -08:00
Junio C Hamano
643b6ef809 Merge branch 'jn/maint-gitweb-pathinfo-fix'
* jn/maint-gitweb-pathinfo-fix:
  gitweb: Fix handling of whitespace in generated links
2010-12-21 14:30:09 -08:00
Jonathan Nieder
77e572653b t0050: fix printf format strings for portability
Unlike bash and ksh, dash passes through hexadecimal \xcc escapes.
So when run with dash, these tests *pass* (since '\xcc' is a perfectly
reasonable filename) but they are not testing what was intended.

Use octal escapes instead, in the spirit of v1.6.1-rc1~55^2
(2008-11-09).

Reported-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-21 13:26:32 -08:00
Ramsay Jones
00f66f0e49 t3419-*.sh: Fix arithmetic expansion syntax error
Some shells, for example dash versions older than 0.5.4, need to
spell a variable reference as '$N' rather than 'N' in an arithmetic
expansion. In order to avoid the syntax error, we change the
offending variable reference from 'i' to '$i' in function scramble.

There is nothing bash specific to this test script (and we shouldn't
have any bash dependent test).  Fix its shebang line.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-21 12:26:21 -08:00
Junio C Hamano
7b3b7e3758 am --abort: keep unrelated commits since the last failure and warn
After making commits (either by pulling or doing their own work) after a
failed "am", the user will be reminded by next "am" invocation that there
was a failed "am" that the user needs to decide to resolve or to get rid
of the old "am" attempt.  The "am --abort" option was meant to help the
latter.  However, it rewinded the HEAD back to the beginning of the failed
"am" attempt, discarding commits made (perhaps by mistake) since.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-21 11:16:28 -08:00
Junio C Hamano
00b0d7f77b set_try_to_free_routine(NULL) means "do nothing special"
This way, the next caller that wants to disable our memory reclamation
machinery does not have to define its own do_nothing() stub.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-21 09:25:14 -08:00
Junio C Hamano
4c28e4ada0 commit: die before asking to edit the log message
When determine_author_info() returns to the calling prepare_to_commit(),
we already know the pieces of information necessary to determine what
author ident will be used in the final message, but deferred making a call
to fmt_ident() before the final commit_tree().  Most importantly, we would
open the editor to ask the user to compose the log message before it.

As one important side effect of fmt_ident() is to error out when the given
information is malformed, this resulted in us spawning the editor first
and then refusing to commit due to error, even though we had enough
information to detect the error before starting the editor, which was
annoying.

Move the fmt_ident() call to the end of determine_author_info() where we
have final determination of author info to rectify this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-20 17:45:51 -08:00
Martin von Zweigbergk
6068ac8848 completion: add missing configuration variables
Quite a few configuration variables have been added since 226b343
(completion: add missing configuration variables to _git_config(),
2009-05-03). Add these variables to the Bash completion script.

Also remove the obsolete 'add.ignore-errors' and
'color.grep.external', as well as 'diff.renameLimit.', which never
existed and rename the misspelled 'sendemail.aliasesfiletype'.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-20 17:21:21 -08:00
Jeff King
4579bb418c ident: die on bogus date format
If the user gives "git commit --date=foobar", we silently
ignore the --date flag. We should note the error.

This patch puts the fix at the lowest level of fmt_ident,
which means it also handles GIT_AUTHOR_DATE=foobar, as well.

There are two down-sides to this approach:

  1. Technically this breaks somebody doing something like
     "git commit --date=now", which happened to work because
     bogus data is the same as "now". Though we do
     explicitly handle the empty string, so anybody passing
     an empty variable through the environment will still
     work.

     If the error is too much, perhaps it can be downgraded
     to a warning?

  2. The error checking happens _after_ the commit message
     is written, which can be annoying to the user. We can
     put explicit checks closer to the beginning of
     git-commit, but that feels a little hack-ish; suddenly
     git-commit has to care about how fmt_ident works. Maybe
     we could simply call fmt_ident earlier?

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-20 10:28:19 -08:00
Kirill Smelkov
9ec09b0495 fill_textconv(): Don't get/put cache if sha1 is not valid
When blaming files in the working tree, the filespec is marked with
!sha1_valid, as we have not given the contents an object name yet.  The
function to cache textconv results (keyed on the object name), however,
didn't check this condition, and ended up on storing the cached result
under a random object name.

Cc: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
Cc: Clément Poulain <clement.poulain@ensimag.imag.fr>
Cc: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Cc: Jeff King <peff@peff.net>
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-19 18:41:32 -08:00
Kirill Smelkov
b1b14ec3f1 t/t8006: Demonstrate blame is broken when cachetextconv is on
I have a git repository with lots of .doc and .pdf files. There diff
works ok, but blaming is painfully slow without textconv cache, and with
textconv cache, blame says lots of lines are 'Not Yet Committed' which
is wrong.

Here is a test that demonstrates the problem.

Cc: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
Cc: Clément Poulain <clement.poulain@ensimag.imag.fr>
Cc: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Cc: Jeff King <peff@peff.net>
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-19 18:17:00 -08:00
Junio C Hamano
f29db856e7 Merge branch 'maint'
* maint:
  gitweb: Include links to feeds in HTML header only for '200 OK' response
  fsck docs: remove outdated and useless diagnostic
  userdiff: fix typo in ruby and python word regexes
  trace.c: mark file-local function static
  Fix typo in git-gc document.
2010-12-19 17:49:42 -08:00
Jonathan Nieder
4de0bbd898 t9300: use perl "head -c" clone in place of "dd bs=1 count=16000" kluge
It is unfortunate to have to issue thousands of one-byte read calls to
work around dd's refusal to buffer input that would fill a block after
a short read (a3a6f4, 2010-12-13).  We could do better by using
"head -c", if it were available on all platforms we cared about.
Replace it with some simple perl.

While doing so, restructure 9300.114 to use a subshell instead of a
script.  Subshells can inherit functions (like the new head_c) from
the parent shell while external scripts cannot.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-19 13:51:09 -08:00
Jeff King
ac5ad864c2 t2107: mark passing test as success
This failed on the branch where it was introduced, but was fixed
by merging with 6e67619 (Merge branch 'jn/parse-options-extra').

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-19 10:49:34 -08:00
Jeff King
db6195efab handle arbitrary ints in git_config_maybe_bool
This function recently gained the ability to recognize the documented "0"
and "1" values as false/true. However, unlike regular git_config_bool, it
did not treat arbitrary non-zero numbers as true.

While this is undocumented and probably ridiculous for somebody to rely
on, it is safer to behave exactly as git_config_bool would. Because
git_config_maybe_bool can be used to retrofit new non-bool values onto
existing bool options, not behaving in exactly the same way is technically
a regression.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-19 10:46:08 -08:00
Thiago Farina
834d9eb6b7 builtin/rm.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-19 10:44:06 -08:00
Thiago Farina
fcbc0d8e82 builtin/branch.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-19 10:43:53 -08:00
Jakub Narebski
05bb5a2584 gitweb: Include links to feeds in HTML header only for '200 OK' response
To do that, generating "<link />"s to feeds were refactored into
print_feed_meta() subroutine, to keep nesting (indent) level in
git_header_html() low.  This has also the advantage of making code
more clear.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-18 22:58:45 -08:00
Mark Lodato
0c806a06a3 fsck docs: remove outdated and useless diagnostic
In git-fsck(1), there was a reference to the warning "<tree> has full
pathnames in it".  This exact wording has not been used since 2005
(commit f1f0d0889e55), when the wording was changed slightly.  More
importantly, the description of that warning was useless, and there were
many other similar warning messages which were not document at all.
Since all these warnings are fairly obvious, there is no need for them
to be in the man page.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-18 22:58:40 -08:00
Thomas Rast
b34f69f991 userdiff: fix typo in ruby and python word regexes
Both had an unclosed ] that ruined the safeguard against not matching
a non-space char.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-18 22:58:40 -08:00
Vasyl' Vavrychuk
8e8aa44057 trace.c: mark file-local function static
Signed-off-by: Vasyl' Vavrychuk <vvavrychuk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-17 13:40:32 -08:00
Tay Ray Chuan
057f327972 bash completion: add basic support for git-reflog
"Promote" the reflog command out of plumbing, so that we now run
completion for it. After all, it's listed under porcelain (ancillary),
and we do run completion for those commands.

Add basic completion for the three subcommands - show, expire, delete.
Try completing refs for these too.

Helped-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-17 11:55:19 -08:00
Jiang Xin
4be0c35224 Fix typo in git-gc document.
The variable gc.packrefs for git-gc can be set to true, false and
"notbare", not "nobare".

Signed-off-by: Jiang Xin <jiangxin@ossxp.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-17 11:53:53 -08:00
Junio C Hamano
1b9743462d Update draft release notes to 1.7.4
We are getting closer to -rc0 ;-)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-16 21:43:08 -08:00
Junio C Hamano
38a5932be8 Merge branch 'maint'
* maint:
  difftool: provide basename to external tools
  git-difftool.txt: correct the description of $BASE and describe $MERGED
2010-12-16 16:36:03 -08:00
Nguyễn Thái Ngọc Duy
4322842acf get_sha1: handle special case $commit^{/}
Empty regex pattern should always match. But the exact behavior of
regexec() may vary. Because it always matches anyway, we can just
return 'matched' without calling regex machinery.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-16 13:11:42 -08:00
Michael J Gruber
4a689afb03 difftool: provide basename to external tools
Currently, only configured diff helpers get the basename of the file
being compared. Tools specified with "git difftool -x" only get the
names of temporary files for the different versions.

Export BASE so that an external tool can read the name from the
environment. Rather than using a third argument, this avoids breaking
existing scripts which may somewhat carelessly be using "$@" rather than
"$1" "$2".

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-16 13:01:36 -08:00
Michael J Gruber
51baceeec4 git-difftool.txt: correct the description of $BASE and describe $MERGED
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-16 13:01:31 -08:00
Junio C Hamano
cf7a64b54a Merge branch 'kb/diff-C-M-synonym'
* kb/diff-C-M-synonym:
  diff: use "find" instead of "detect" as prefix for long forms of -M and -C
  diff: add --detect-copies-harder as a synonym for --find-copies-harder
2010-12-16 12:58:59 -08:00
Junio C Hamano
914584266c Merge branch 'jn/fast-import-blob-access'
* jn/fast-import-blob-access:
  t9300: avoid short reads from dd
  t9300: remove unnecessary use of /dev/stdin
  fast-import: Allow cat-blob requests at arbitrary points in stream
  fast-import: let importers retrieve blobs
  fast-import: clarify documentation of "feature" command
  fast-import: stricter parsing of integer options

Conflicts:
	fast-import.c
2010-12-16 12:58:38 -08:00
Junio C Hamano
4bb4d30095 Merge branch 'jl/fetch-submodule-recursive'
* jl/fetch-submodule-recursive:
  fetch_populated_submodules(): document dynamic allocation
  Submodules: Add the "fetchRecurseSubmodules" config option
  Add the 'fetch.recurseSubmodules' config setting
  fetch/pull: Add the --recurse-submodules option

Conflicts:
	builtin/fetch.c
2010-12-16 12:57:15 -08:00
Junio C Hamano
b5c6aac01b Merge branch 'rj/msvc-fix'
* rj/msvc-fix:
  msvc: Fix macro redefinition warnings
  msvc: Fix build by adding missing INTMAX_MAX define
  msvc: git-daemon.exe: Fix linker "unresolved externals" error
  msvc: Fix compilation errors in compat/win32/sys/poll.c
2010-12-16 12:55:36 -08:00
Junio C Hamano
620b89cd98 Merge branch 'nd/extended-sha1-relpath'
* nd/extended-sha1-relpath:
  get_sha1: teach ":$n:<path>" the same relative path logic
  get_sha1: support relative path ":path" syntax
  Make prefix_path() return char* without const

Conflicts:
	sha1_name.c
2010-12-16 12:51:05 -08:00
Junio C Hamano
f68b780b25 Merge branch 'aa/status-hilite-branch'
* aa/status-hilite-branch:
  default color.status.branch to "same as header"
  status: show branchname with a configurable color
2010-12-16 12:50:03 -08:00
Junio C Hamano
b932c3c1c1 Merge branch 'ak/describe-exact'
* ak/describe-exact:
  describe: Delay looking up commits until searching for an inexact match
  describe: Store commit_names in a hash table by commit SHA1
  describe: Do not use a flex array in struct commit_name
  describe: Use for_each_rawref
2010-12-16 12:49:59 -08:00
Junio C Hamano
20cb8e2025 Merge branch 'nd/maint-relative'
* nd/maint-relative:
  get_cwd_relative(): do not misinterpret root path
2010-12-16 12:49:48 -08:00
Junio C Hamano
b720c75afd Merge branch 'jn/maint-svn-fe'
* jn/maint-svn-fe:
  t9010 fails when no svn is available
  vcs-svn: fix intermittent repo_tree corruption
  treap: make treap_insert return inserted node
  t9010 (svn-fe): Eliminate dependency on svn perl bindings
2010-12-16 12:49:35 -08:00