1
0
mirror of https://github.com/git/git.git synced 2024-09-30 07:51:31 +02:00
Commit Graph

6411 Commits

Author SHA1 Message Date
Junio C Hamano
5cc3cef997 lock_ref_sha1(): do not sometimes error() and sometimes die().
This cleans up the error path in the function so it does not
die() itself sometimes while signalling an error with NULL some
other times which was inconsistent and confusing.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-30 15:07:58 -07:00
Junio C Hamano
5e290ff75a refs: minor restructuring of cached refs data.
Once we read packed and loose refs, for_each_ref() and friends
kept using them even after write_ref_sha1() and delete_ref()
changed the refs.  This adds invalidate_cached_refs() as a way
to flush the cached information.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-30 15:07:58 -07:00
Junio C Hamano
bc7127ef0f ref locking: allow 'foo' when 'foo/bar' used to exist but not anymore.
It is normal to have .git/refs/heads/foo directory which is
empty after the last branch whose name starts with foo/ is
removed.  Make sure we notice this case and allow creation of
branch foo by removing the empty directory.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-30 15:07:58 -07:00
Christian Couder
fc12f0829d Uncomment test case: git branch c/d should barf if branch c exists.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 22:26:43 -07:00
Christian Couder
5be7649131 When creating branch c/d check that branch c does not already exists.
With packed refs, there may not be a ".git/refs/heads/c" file
when branch c exists. And currently in this case, there is no check
to prevent creation of branch c/d.

This should probably be rewritten in C and done after the ref lock
has been taken to make sure no race exists though.

This is mainly to make all test cases in "t3210-pack-refs.sh" work.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 22:26:31 -07:00
Christian Couder
919a3c9813 Add pack-refs and show-ref test cases.
Some of these test cases are from Junio.
One test case is commented out because it doesn't work right now.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 22:24:45 -07:00
Junio C Hamano
2958d9b5db Merge branch 'master' into lj/refs
* master: (72 commits)
  runstatus: do not recurse into subdirectories if not needed
  grep: fix --fixed-strings combined with expression.
  grep: free expressions and patterns when done.
  Corrected copy-and-paste thinko in ignore executable bit test case.
  An illustration of rev-list --parents --pretty=raw
  Allow git-checkout when on a non-existant branch.
  gitweb: Decode long title for link tooltips
  git-svn: Fix fetch --no-ignore-externals with GIT_SVN_NO_LIB=1
  Ignore executable bit when adding files if filemode=0.
  Remove empty ref directories that prevent creating a ref.
  Use const for interpolate arguments
  git-archive: update documentation
  Deprecate merge-recursive.py
  gitweb: fix over-eager application of esc_html().
  Allow '(no author)' in git-svn's authors file.
  Allow 'svn fetch' on '(no date)' revisions in Subversion.
  git-repack: allow git-repack to run in subdirectory
  Remove upload-tar and make git-tar-tree a thin wrapper to git-archive
  git-tar-tree: Move code for git-archive --format=tar to archive-tar.c
  git-tar-tree: Remove duplicate git_config() call
  ...
2006-09-27 22:23:12 -07:00
Junio C Hamano
51b2dd4e3f Merge branch 'cc/branch-test'
* cc/branch-test:
  Remove empty ref directories that prevent creating a ref.
2006-09-27 22:17:01 -07:00
Junio C Hamano
194db7e3bb Merge branch 'jc/for-each-ref' into jc/ref-locking
* jc/for-each-ref:
  git-for-each-ref: improve the documentation on scripting modes
2006-09-27 22:00:54 -07:00
Junio C Hamano
2b83ade977 Merge branch 'sp/void'
* sp/void:
  Allow git-checkout when on a non-existant branch.
2006-09-27 21:51:29 -07:00
Junio C Hamano
f2ce6a4c3c Merge branch 'jc/whitespace'
* jc/whitespace:
  git-apply: second war on whitespace.
  diff.c: second war on whitespace.
2006-09-27 21:50:42 -07:00
Junio C Hamano
1ad7a06adb Merge branch 'jc/repack'
* jc/repack:
  git-repack: allow git-repack to run in subdirectory
  repack: use only pack-objects, not rev-list.
2006-09-27 21:46:07 -07:00
Junio C Hamano
e38604e006 Merge branch 'jc/deprecate-recursive'
* jc/deprecate-recursive:
  Deprecate merge-recursive.py
2006-09-27 21:41:24 -07:00
Johannes Schindelin
07ccbff89b runstatus: do not recurse into subdirectories if not needed
This speeds up the case when you run git-status, having an untracked
subdirectory containing huge amounts of files.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 21:36:54 -07:00
Junio C Hamano
a3f5d02edb grep: fix --fixed-strings combined with expression.
"git grep --fixed-strings -e GIT --and -e VERSION .gitignore"
misbehaved because we did not notice this needs to grab lines
that have the given two fixed strings at the same time.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 16:42:53 -07:00
Junio C Hamano
b48fb5b6a9 grep: free expressions and patterns when done.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 16:27:10 -07:00
Junio C Hamano
94d8213f2c receive-pack: call setup_ident before git_config
Otherwise we would end up getting values from Gecos which is often not
what people would want.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 13:47:21 -07:00
Shawn Pearce
209e756931 Corrected copy-and-paste thinko in ignore executable bit test case.
This test should be testing update-index --add, not git-add as the
latter is implemented in terms of the former.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 12:44:02 -07:00
Junio C Hamano
16652170bf An illustration of rev-list --parents --pretty=raw
This script creates two separate histories, A and B, each of
which does:

      (A0, B0): create fileA and subdir/fileB
      (A1, B1): modify fileA
      (A2, B2): modify subdir/fileB

and then grafts them together to make B0 a child of A2.  So
the final history looks like (time flows from top to bottom):

		true parent	touches subdir?

	A0	none		yes (creates it)
        A1      A0		no
        A2	A1		yes
        B0	none		yes (different from what's in A2)
        B1	B0		no
        B2	B1		yes

"git rev-list --parents --pretty=raw B2" would give "fake"
parents on the "commit " header lines while "parent " header
lines show the parent as recorded in the commit object (i.e. B0
appears to have A2 as its parent on "commit " header but there
is no "parent A2" header line in it).

When you have path limiters, we simplify history to omit
commits that do not affect the specified paths.

So "git rev-list --parents --pretty=raw B2 subdir" would return
"B2 B0 A2 A0" (because B1 and A1 do not touch the path).  When
it does so, the "commit " header lines have "fake" parents
(i.e. B2 appears to have B0 as its parent on "commit " header),
but you can still get the true parents by looking at "parent "
header.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 12:34:37 -07:00
Junio C Hamano
3159c8dc2d Teach receive-pack about ref-log
This converts receive-pack to use the standard ref locking code
instead of its own.  As a side effect, it automatically records
the "push" event to ref-log if enabled.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 02:45:07 -07:00
Junio C Hamano
cede752653 update a few Porcelain-ish for ref lock safety.
This updates the use of git-update-ref in git-branch, git-tag
and git-commit to make them safer in a few corner cases as
demonstration.

 - git-tag makes sure that the named tag does not exist, allows
   you to edit tag message and then creates the tag.  If a tag
   with the same name was created by somebody else in the
   meantime, it used to happily overwrote it.  Now it notices
   the situation.

 - git-branch -d and git-commit (for the initial commit) had the
   same issue but with smaller race window, which is plugged
   with this.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 02:06:31 -07:00
Junio C Hamano
ac5409e420 update-ref: -d flag and ref creation safety.
This adds -d flag to update-ref to allow safe deletion of ref.
Before deleting it, the command checks if the given <oldvalue>
still matches the value the caller thought the ref contained.

Similarly, it also accepts 0{40} or an empty string as <oldvalue>
to allow safe creation of a new ref.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 02:01:42 -07:00
Junio C Hamano
4431fcc4b1 Clean-up lock-ref implementation
This drops "mustexist" parameter lock_ref_sha1() and lock_any_ref_forupdate()
functions take.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 01:42:44 -07:00
Junio C Hamano
e9800b28c2 Merge branch 'jc/lt-ref2-with-lt-refs' into jc/ref-locking
* jc/lt-ref2-with-lt-refs:
  Fix show-ref usage for --dereference.
  Document git-show-ref [-s|--hash] option.
  Add man page for git-show-ref
  gitignore: git-show-ref is a generated file.
  Use Linus' show ref in "git-branch.sh".
  Add [-s|--hash] option to Linus' show-ref.
  Teach "git checkout" to use git-show-ref
  Add "git show-ref" builtin command
2006-09-27 00:53:29 -07:00
Junio C Hamano
244a0ae114 Merge branch 'jc/for-each-ref-with-lt-refs' into jc/ref-locking
* jc/for-each-ref-with-lt-refs:
  Add git-for-each-ref: helper for language bindings
2006-09-27 00:53:16 -07:00
Shawn Pearce
5a03e7f253 Allow git-checkout when on a non-existant branch.
I've seen some users get into situtations where their HEAD
symbolic-ref is pointing at a non-existant ref.  (Sometimes this
happens during clone when the remote repository lacks a 'master'
branch.)  If this happens the user is unable to use git-checkout
to switch branches as there is no prior commit to merge from.

So instead of giving the user low-level errors about how HEAD
can't be resolved and how not a single revision was given change
the type of checkout to be a force and go through with the user's
request anyway.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 00:43:50 -07:00
Yasushi SHOJI
4a0641b7cf gitweb: Decode long title for link tooltips
This is a simple one liner to decode long title string in perl's
internal form to utf-8 for link tooltips.

This is not crucial if the commit message is all in ASCII, however, if
you decide to use other encoding, such as UTF-8, tooltips ain't
readable any more.

Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 00:08:51 -07:00
Sergey Vlasov
191414c025 git-svn: Fix fetch --no-ignore-externals with GIT_SVN_NO_LIB=1
When using Subversion 1.3.1 without Perl bindings (GIT_SVN_NO_LIB=1),
"git-svn fetch --no-ignore-externals" fails with errors like:

  Tree (.../.git/svn/git-svn/tree) is not clean:
  X      directory_with_external

In this case the 'X' lines in the "svn status" output are not a sign
of unclean tree, and therefore should be ignored.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-26 23:43:12 -07:00
Shawn Pearce
fd28b34afd Ignore executable bit when adding files if filemode=0.
If the user has configured core.filemode=0 then we shouldn't set
the execute bit in the index when adding a new file as the user
has indicated that the local filesystem can't be trusted.

This means that when adding files that should be marked executable
in a repository with core.filemode=0 the user must perform a
'git update-index --chmod=+x' on the file before committing the
addition.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-26 22:42:52 -07:00
Christian Couder
9c7b0b3fc4 Remove empty ref directories that prevent creating a ref.
This patch also adds test cases from Linus and Junio.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-25 23:54:40 -07:00
Alex Riesen
4dafd7d244 Use const for interpolate arguments
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-25 22:11:26 -07:00
Franck Bui-Huu
e8daf78a00 git-archive: update documentation
This patch documents zip backend options.

It also adds git-archive command into the main git manual
page.

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-25 21:17:43 -07:00
Junio C Hamano
a06f678eb9 Deprecate merge-recursive.py
This renames merge-recursive written in Python to merge-recursive-old,
and makes merge-recur as a synonym to merge-recursive.  We do not remove
merge-recur yet, but we will remove merge-recur and merge-recursive-old
in a few releases down the road.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:33:35 -07:00
Petr Baudis
8391548e5e gitweb: fix over-eager application of esc_html().
Contents of %diffinfo hash should be quoted upon output but kept
unquoted internally.  Later users of this hash expect filenames
to be filenames, not HTML gibberish.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:33:09 -07:00
Shawn Pearce
8815788e93 Allow '(no author)' in git-svn's authors file.
When trying to import an SVN revision which has no author the Git
user may desire to relabel '(no author)' to another name and email
address with their svn.authorsfile.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:19:28 -07:00
Shawn Pearce
f7bae37f9a Allow 'svn fetch' on '(no date)' revisions in Subversion.
Added --ignore-nodate to allow 'git svn fetch' to import revisions
from Subversion which have '(no date)' listed as the date of the
revision.  By default 'git svn fetch' will crash with an error
when encountering such a revision.  The user may restart the fetch
operation by adding --ignore-nodate if they want to continue tracking
that repository.

I'm not entirely sure why a centralized version control system such
as Subversion permits revisions to be created with absolutely no
date/time associated with it but it apparently is possible as one
of the Subversion repositories that I'm tracking with 'git svn'
created such a revision on '(no date)' and by '(no user)'.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:19:22 -07:00
Jeff King
d0b353b1a7 git-repack: allow git-repack to run in subdirectory
Now that we explicitly create all tmpfiles below $GIT_DIR, there's no reason
to care about which directory we're in.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:16:23 -07:00
Junio C Hamano
2f60e4e9c1 Merge branch 'sk/svnimport'
* sk/svnimport:
  git-svnimport: Parse log message for Signed-off-by: lines
2006-09-24 20:00:59 -07:00
Junio C Hamano
d1cb7ac49b Merge early parts of branch 'np/pack' 2006-09-24 19:58:30 -07:00
Junio C Hamano
fd88d9c81e Remove upload-tar and make git-tar-tree a thin wrapper to git-archive
The command now issues a big deprecation warning message and runs
git-archive command with appropriate arguments.

git-tar-tree $tree_ish $base always forces $base to be the leading
directory name, so the --prefix parameter passed internally to
git-archive is a slash appended to it, i.e. "--prefix=$base/".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 19:55:08 -07:00
Rene Scharfe
3d74982f0b git-tar-tree: Move code for git-archive --format=tar to archive-tar.c
This patch doesn't change any functionality, it only moves code around.  It
makes seeing the few remaining lines of git-tar-tree code easier. ;-)

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 19:55:08 -07:00
Rene Scharfe
81b84c42d6 git-tar-tree: Remove duplicate git_config() call
generate_tar() eventually calls write_tar_archive() which does all the
"real" work and which also calls git_config(git_tar_config).  We only
need to do this once.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 19:55:07 -07:00
Junio C Hamano
b0ed9eafb3 Merge branch 'jc/filter-commit'
* jc/filter-commit:
  git log: Unify header_filter and message_filter into one.
  Update grep internal for grepping only in head/body
  git-log --author and --committer are not left-anchored by default
  rev-list: fix segfault with --{author,committer,grep}
  revision traversal: --author, --committer, and --grep.
  revision traversal: prepare for commit log match.
  builtin-grep: make pieces of it available as library.
2006-09-24 19:53:52 -07:00
Junio C Hamano
700899b624 Merge branch 'sb/branch-attributes'
* sb/branch-attributes:
  Add test for the default merges in fetch.
  fetch: get the remote branches to merge from the branch properties
  Add t5510 to test per branch configuration affecting git-fetch.
  Fetch: default remote repository from branch properties
2006-09-24 19:20:26 -07:00
Junio C Hamano
043c04107c Merge branch 'jl/daemon'
* jl/daemon:
  Add virtualization support to git-daemon
2006-09-24 16:58:34 -07:00
Santi Béjar
6cc7c36d5e Add test for the default merges in fetch.
[jc: with minor fix-ups]

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 02:00:21 -07:00
Santi Béjar
5372806a84 fetch: get the remote branches to merge from the branch properties
If in branch "foo" and this in config:

[branch "foo"]
      merge=bar

"git fetch": fetch from the default repository and program the "bar"
             branch to be merged with pull.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 00:13:49 -07:00
Junio C Hamano
7be1d62c6f Add t5510 to test per branch configuration affecting git-fetch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 00:13:49 -07:00
Santi Béjar
648ad18f50 Fetch: default remote repository from branch properties
If in branch "foo" and this in config:

[branch "foo"]
       remote=bar

"git fetch" = "git fetch bar"
"git  pull" = "git pull  bar"

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 00:13:49 -07:00
Junio C Hamano
d0c25035df git-apply: second war on whitespace.
This makes --whitespace={warn,error,strip} option to also notice
the leading whitespace errors in addition to the trailing
whitespace errors.  Spaces that are followed by a tab in indent
are detected as errors, and --whitespace=strip option fixes them.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 00:12:44 -07:00