Code

git.git
17 years agogit-svn: fetch tracks initial change with --follow-parent
Eric Wong [Tue, 30 Jan 2007 08:35:18 +0000 (00:35 -0800)]
git-svn: fetch tracks initial change with --follow-parent

We were still skipping path information from get_log if we are
tracking /r9270/drunk/subversion/bindings/..., but got something
like this in the log:

   A /r9270/drunk (from /r9270/trunk:14)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: don't rely on do_switch + reparenting with svn(+ssh)://
Eric Wong [Tue, 30 Jan 2007 03:16:01 +0000 (19:16 -0800)]
git-svn: don't rely on do_switch + reparenting with svn(+ssh)://

I can't seem to figure out what I or the SVN libraries are doing
wrong, but it appears to be related to reparent and probably
some global structure that gets reset if multiple SVN
connections are being used.

So now, in order to use do_switch; we'll open a new connection
to the repository with the complete URL; but we can't seem to
ever use an existing Ra object after another one has been
created...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: reinstate the default SVN error handler after using get_log
Eric Wong [Tue, 30 Jan 2007 02:34:55 +0000 (18:34 -0800)]
git-svn: reinstate the default SVN error handler after using get_log

We don't need our own error handler for other operations.  Also
add a message about the successfully do_switch or do_update in
follow-parent for debugging do_switch failures with svn:// and
svn+ssh:// connections.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: just use Digest::MD5 instead of requiring it
Eric Wong [Tue, 30 Jan 2007 00:27:08 +0000 (16:27 -0800)]
git-svn: just use Digest::MD5 instead of requiring it

Historically, git-svn did not always use Digest::MD5 because
it did not use the SVN::Delta::Editor interfaces.  Nowadays
it does, and the requires make strace more noisy.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: cleanup: move editor-specific variables into the editor namespace
Eric Wong [Mon, 29 Jan 2007 08:07:49 +0000 (00:07 -0800)]
git-svn: cleanup: move editor-specific variables into the editor namespace

Also removed some unused/redundant functions.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: stop using path names as refnames with --follow-parent
Eric Wong [Mon, 29 Jan 2007 05:34:23 +0000 (21:34 -0800)]
git-svn: stop using path names as refnames with --follow-parent

Using path names as refnames breaks horribly if a user is
tracking one large, toplevel directory, and a lower-level
directory is followed from another project is a parent
of another ref, as it will cause refnames such as:
'refs/remotes/trunk/path/to/stuff', which will conflict
with a refname of 'refs/remotes/trunk'.

Now we just append @$revno to the end of it the current
refname.  And if we have followed back to a grandparent, then
we'll strip any existing '@$parent_revno' strings before
appending our own '@$revno' string to it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: correctly handle do_{switch,update} in deep directories
Eric Wong [Sun, 28 Jan 2007 12:59:05 +0000 (04:59 -0800)]
git-svn: correctly handle do_{switch,update} in deep directories

The do_update or do_switch functions in SVN only allow for a
single path component; so 'path/to/deep/dir' would be
interpreted as 'path'.

SVN 1.4.x has a reparent function that can let us change the
session to use a higher-level root of the repository, so we can
use that for do_switch (which still doesn't seem to work in SVN
1.4.3 (a fix was attempted, but they missed the rest of the
typemap changes needed in trunk...)).

On the do_update side, we can use set_path on higher level
directories and set them to a newer revision so they don't get
updated.  We can't do this with do_switch, either, because the
relative path we're tracking can change (directory moving into
a child of itself).

Because of these changes, we need to double check that our Fetch
editor is correctly performing stripping on any prefixed paths
from update, otherwise we'll just die() because that would be
a bug.

Added a test case which helped me notice and fix problems with
do_switch, too.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: correctly track diff-less copies with do_switch
Eric Wong [Sun, 28 Jan 2007 12:02:01 +0000 (04:02 -0800)]
git-svn: correctly track diff-less copies with do_switch

Also, this should allow for the tracking of new, but empty
directories where we would want to see the log message.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: allow multi-fetch to fetch things chronologically
Eric Wong [Sun, 28 Jan 2007 06:28:56 +0000 (22:28 -0800)]
git-svn: allow multi-fetch to fetch things chronologically

Since single fetching is a special case of multi-fetch,
share code with it and the fetch loop into Git::SVN::Ra
since it uses a single Ra connection and multiple
Git::SVN objects.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: cleanup remove unused function
Eric Wong [Sat, 27 Jan 2007 22:38:10 +0000 (14:38 -0800)]
git-svn: cleanup remove unused function

Also move tz_to_s_offset into Git::SVN::Log since that's
the only place it's used now.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: simplify usage of the SVN::Git::Editor interface
Eric Wong [Sat, 27 Jan 2007 22:33:08 +0000 (14:33 -0800)]
git-svn: simplify usage of the SVN::Git::Editor interface

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: avoid an extra svn_ra connection during commits
Eric Wong [Sat, 27 Jan 2007 09:32:00 +0000 (01:32 -0800)]
git-svn: avoid an extra svn_ra connection during commits

Before, we needed a separate svn_ra instance to run
our check_path calls once the editor was active; but
we can avoid that by running all the check_path calls
before our editor is active.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fix committing to subdirectories, add tests
Eric Wong [Fri, 26 Jan 2007 09:32:45 +0000 (01:32 -0800)]
git-svn: fix committing to subdirectories, add tests

I broke this part with the URL minimization; since
git-svn will now try to connect to the root of
the repository and will end up writing files
there if it can...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fix segfaults from accessing svn_log_changed_path_t
Eric Wong [Fri, 26 Jan 2007 01:35:40 +0000 (17:35 -0800)]
git-svn: fix segfaults from accessing svn_log_changed_path_t

svn_log_changed_path_t structs were being used out of scope
outside of svn_ra_get_log (because I wanted to eventually be
able to use git-svn with only a single connection to the
repository).  So now we dup them into a hash.

This was fixed while making --follow-parent fetches more
efficient.  I've moved parsing of the command-line --revision
argument outside of the Git::SVN module so Git::SVN::fetch() can
be used in more places (such as find_parent_branch).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: correctly track revisions made to deleted branches
Eric Wong [Thu, 25 Jan 2007 23:44:54 +0000 (15:44 -0800)]
git-svn: correctly track revisions made to deleted branches

git-svn has never been able to handle deleted branches very well
because svn_ra_get_log() is all-or-nothing, meaning that if the
max revision passed to it does not contain the path we're
tracking, we miss all the revisions in the repository.

Branches fetched using --follow-parent still do this
sub-optimally (will be fixed soon).  --follow-parent will soon
become the default, so we will assume that when using get_log();

We will also avoid tracking revprops for revisions with no
path-related changes since otherwise we just end up pulling
logs to paths we don't care about.

Also added a test for this to t9104-git-svn-follow-parent.sh and
correctly commit the log message in the preceeding test (which
conflicted with a filename).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: avoid tracking change-less revisions
Eric Wong [Thu, 25 Jan 2007 19:53:13 +0000 (11:53 -0800)]
git-svn: avoid tracking change-less revisions

They simply aren't interesting to track, and this will allow
us to avoid get_log().

Since r0 is covered by this, we need to update the tests to not
rely on r0 (which is always empty).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: add an odd test case that seems to cause segfaults over HTTP
Eric Wong [Thu, 25 Jan 2007 18:52:36 +0000 (10:52 -0800)]
git-svn: add an odd test case that seems to cause segfaults over HTTP

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: track writes writes to the index in fetch
Eric Wong [Wed, 24 Jan 2007 11:30:57 +0000 (03:30 -0800)]
git-svn: track writes writes to the index in fetch

Introducing Git::IndexInfo.  This module will probably be useful
outside of git-svn, so I'm not putting it in the Git::SVN
namespace.

This will allow me to more easily avoid the use of get_log() in
the future and simply run do_update in incrementing ranges.
get_log() should be avoided because there are cases where
moved/deleted directories do not track correctly (until
--follow-parent is run on a new branch).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: --follow-parent now works on sub-directories of larger branches
Eric Wong [Wed, 24 Jan 2007 10:16:25 +0000 (02:16 -0800)]
git-svn: --follow-parent now works on sub-directories of larger branches

This means that tracking the path of:

  /another-larger/trunk/thunk/bump/thud inside a repository

would follow:

  /larger-parent/trunk/thunk/bump/thud

even if the svn log output looks like this:
  --------------------------------------------
  Changed paths:
     A /another-larger (from /larger-parent:5)
  --------------------------------------------

Note: the usage of get_log() in git-svn still makes a
an assumption that shouldn't be made with regard to
revisions existing for a particular path.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: 'init' attempts to connect to the repository root if possible
Eric Wong [Wed, 24 Jan 2007 00:29:23 +0000 (16:29 -0800)]
git-svn: 'init' attempts to connect to the repository root if possible

This allows connections to be used more efficiently and not require
users to run 'git-svn migrate --minimize' for new repositories.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: better error reporting if --follow-parent fails
Eric Wong [Tue, 23 Jan 2007 21:03:29 +0000 (13:03 -0800)]
git-svn: better error reporting if --follow-parent fails

This will be useful to me when I try more special-cases
of parent-tracking.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: allow 'init' to work outside of tests
Eric Wong [Tue, 23 Jan 2007 19:35:53 +0000 (11:35 -0800)]
git-svn: allow 'init' to work outside of tests

Tests always ran 'git init' before we ran so that repo-config
would always have something to read.  However that does not work
in real-world situations where the user expects 'git svn init'
to work without running 'git init' first.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: get rid of additional fetch-arguments
Eric Wong [Mon, 22 Jan 2007 23:47:41 +0000 (15:47 -0800)]
git-svn: get rid of additional fetch-arguments

It's not really useful anymore now that we have a better
--follow-parent for the valid cases.  Any other use
of it is not valid.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: allow --follow-parent on deleted directories
Eric Wong [Mon, 22 Jan 2007 23:22:50 +0000 (15:22 -0800)]
git-svn: allow --follow-parent on deleted directories

Any operations on the index in Git::SVN that is not wrapped by
tmp_index_do() is wrong.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: disallow ambigious local refspecs
Eric Wong [Mon, 22 Jan 2007 21:52:04 +0000 (13:52 -0800)]
git-svn: disallow ambigious local refspecs

Having multiple fetch refspecs pointing to the same local ref
would be a very bad thing.  Start avoiding the use of fatal() or
exit() inside the modules so we can libify more easily.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: --follow-parent works with svn-remotes multiple branches
Eric Wong [Mon, 22 Jan 2007 19:44:57 +0000 (11:44 -0800)]
git-svn: --follow-parent works with svn-remotes multiple branches

Bugs fixed:

 * We didn't allow manually (not using git-svn) init-ed
   remotes/fetch refspecs to be used before.  It works now
   because that's what I did in this test.  git-svn init should
   offer more control in the future.
 * correctly strip paths in the delta editor when using
   do_switch().
 * Make the -i / GIT_SVN_ID option work correctly when doing
   fetch on a multi-ref svn-remote

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fix --follow-parent to work with Git::SVN
Eric Wong [Mon, 22 Jan 2007 10:20:33 +0000 (02:20 -0800)]
git-svn: fix --follow-parent to work with Git::SVN

While we're at it, beef up the test because I was
getting false-passes during development.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: enable --minimize to simplify the config and connections
Eric Wong [Sun, 21 Jan 2007 12:27:09 +0000 (04:27 -0800)]
git-svn: enable --minimize to simplify the config and connections

--minimize will update the git-svn configuration to attempt to
connect to the repository root (instead of directly to the
path(s) we are tracking) in order to allow more efficient reuse
of connections (for multi-fetch and follow-parent).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: reuse open SVN::Ra connections by URL
Eric Wong [Fri, 19 Jan 2007 02:22:18 +0000 (18:22 -0800)]
git-svn: reuse open SVN::Ra connections by URL

Note: this can cause problems with Perl's reference counting GC,
so I'm disabling Git::SVN::Ra::DESTROY.  If we notice more
problems down the line, we can disable this enhancement.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fix a regression in dcommit that caused empty log messages
Eric Wong [Fri, 19 Jan 2007 02:15:23 +0000 (18:15 -0800)]
git-svn: fix a regression in dcommit that caused empty log messages

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: add support for metadata in .git/config
Eric Wong [Fri, 19 Jan 2007 01:50:01 +0000 (17:50 -0800)]
git-svn: add support for metadata in .git/config

Of course, we handle metadata migrations from previous versions
and we have added unit tests.

The new .git/config remotes resemble non-SVN remotes.  Below
is an example with comments:

[svn-remote "git-svn"]
; like non-svn remotes, we have one URL per-remote
url = http://foo.bar.org/svn

; 'fetch' keys are done in the same way as non-svn
; remotes, too.  With the left-hand-side of the ':'
; being the remote (SVN) repository path relative to the
; above 'url' key; and the right-hand-side being a
; remote ref in git (refs/remotes/*).
; An empty left-hand-side means that it will fetch
; the entire contents of the 'url' key.
; old-style (migrated from previous versions of git-svn)
; are like this:
fetch = :refs/remotes/git-svn

; this is created by a current version of git-svn
; using the multi-init command with an explicit
; url (specified above).  This allows multi-init
; to reuse SVN::Ra connections.
fetch = trunk:refs/remotes/trunk
fetch = branches/a:refs/remotes/a
fetch = branches/b:refs/remotes/b
fetch = tags/0.1:refs/remotes/tags/0.1
fetch = tags/0.2:refs/remotes/tags/0.2
fetch = tags/0.3:refs/remotes/tags/0.3

[svn-remote "alt"]
; this is another old-style remote migrated over
; to the new config format
url = http://foo.bar.org/alt
fetch = :refs/remotes/alt

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: remove graft-branches command
Eric Wong [Tue, 16 Jan 2007 06:59:26 +0000 (22:59 -0800)]
git-svn: remove graft-branches command

It's becoming a maintenance burden.  I've never found it
particularly useful myself, nor have I heard much feedback about
it; so I'm assuming it's just as useless to everyone else.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: convert 'set-tree' command to use Git::SVN
Eric Wong [Mon, 15 Jan 2007 07:21:16 +0000 (23:21 -0800)]
git-svn: convert 'set-tree' command to use Git::SVN

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: switch dcommit to using Git::SVN code
Eric Wong [Sun, 14 Jan 2007 11:14:28 +0000 (03:14 -0800)]
git-svn: switch dcommit to using Git::SVN code

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fetch/multi-fetch converted over to Git::SVN module
Eric Wong [Sun, 14 Jan 2007 10:17:00 +0000 (02:17 -0800)]
git-svn: fetch/multi-fetch converted over to Git::SVN module

--follow-parent and commit-diff are currently broken with
this commit...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: get rid of Memoize for now...
Eric Wong [Sun, 14 Jan 2007 07:00:47 +0000 (23:00 -0800)]
git-svn: get rid of Memoize for now...

I may refactor more of this stuff into separate modules

17 years agogit-svn: convert the 'commit-diff' command to Git::SVN
Eric Wong [Sun, 14 Jan 2007 06:35:53 +0000 (22:35 -0800)]
git-svn: convert the 'commit-diff' command to Git::SVN

Also, convert all usage of 'log_msg' to 'log_entry' for
consistency's sake

SVN::Git::Editor::apply_diff now drives the rest of the
editor.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: do not let Git.pm warn if we prematurely close pipes
Eric Wong [Fri, 12 Jan 2007 11:07:31 +0000 (03:07 -0800)]
git-svn: do not let Git.pm warn if we prematurely close pipes

This mainly quiets down warnings when running git svn log.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: port the 'rebuild' command to use Git::SVN objects
Eric Wong [Fri, 12 Jan 2007 10:49:01 +0000 (02:49 -0800)]
git-svn: port the 'rebuild' command to use Git::SVN objects

Also correctly shared some variables needed for Git::SVN::Log

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: moved the 'log' command into its own namespace
Eric Wong [Fri, 12 Jan 2007 10:35:20 +0000 (02:35 -0800)]
git-svn: moved the 'log' command into its own namespace

More cleanup to separate out functionality and make things
nicer to hack on.

While we're at it, centralize loading of the authors into
one place and correctly handle '(no author)' cases in
when showing logs after-the-fact; and not just at commit
time.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: convert show-ignore over to Git::SVN
Eric Wong [Fri, 12 Jan 2007 01:58:39 +0000 (17:58 -0800)]
git-svn: convert show-ignore over to Git::SVN

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: add a test for show-ignore
Eric Wong [Fri, 12 Jan 2007 01:55:50 +0000 (17:55 -0800)]
git-svn: add a test for show-ignore

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: make multi-init capable of reusing the Ra connection
Eric Wong [Fri, 12 Jan 2007 01:09:26 +0000 (17:09 -0800)]
git-svn: make multi-init capable of reusing the Ra connection

If a user specified a seperate URL and --tags/--branches as
a sepearte URL, allow the Ra object (and therefore the connection)
to be reused.

We'll get rid of libsvn_ls_fullurl() since it was only used
in one place.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: convert multi-init over to using Git::SVN
Eric Wong [Thu, 11 Jan 2007 23:35:55 +0000 (15:35 -0800)]
git-svn: convert multi-init over to using Git::SVN

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: convert 'init' to use Git::SVN
Eric Wong [Thu, 11 Jan 2007 20:26:16 +0000 (12:26 -0800)]
git-svn: convert 'init' to use Git::SVN

While we're at it, fix up some bugs in Git::SVN.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: add Git::SVN module (to avoid global variables)
Eric Wong [Thu, 11 Jan 2007 20:14:21 +0000 (12:14 -0800)]
git-svn: add Git::SVN module (to avoid global variables)

This should make it easier to improve multi-fetch and
--follow-parent by avoiding global variables.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: cleanup: avoid re-use()ing Git.pm in sub-packages
Eric Wong [Thu, 11 Jan 2007 10:14:43 +0000 (02:14 -0800)]
git-svn: cleanup: avoid re-use()ing Git.pm in sub-packages

I will be using functions from Git.pm in more modules, so I
want to avoid re-importing the long argument list everywhere
it's used.

Also removed an unused command-line switch
(--no-ignore-externals) and some variables.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: cleanup: put SVN workarounds into their own namespace
Eric Wong [Wed, 10 Jan 2007 09:22:38 +0000 (01:22 -0800)]
git-svn: cleanup: put SVN workarounds into their own namespace

Force some svn_ra functions to use a temporary pool via wrapper

This cleans up the code a bit by removing explicit instances of
pool allocation and deallocation and providing wrapper functions
that make use of temporary pools.

I've also added an explicit pool usage when creating the commit
editor for commit-diff where get_commit_editor can be called
multiple times with the same pool previously.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: cleanup: move process_rm around
Eric Wong [Thu, 4 Jan 2007 09:38:18 +0000 (01:38 -0800)]
git-svn: cleanup: move process_rm around

(it's only used in one function now)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: move authentication prompts into their own namespace
Eric Wong [Thu, 4 Jan 2007 08:45:03 +0000 (00:45 -0800)]
git-svn: move authentication prompts into their own namespace

I'm going to be reorganizing some more code.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agoMerge branches 'lt/crlf' and 'jc/apply-config'
Junio C Hamano [Fri, 23 Feb 2007 05:34:36 +0000 (21:34 -0800)]
Merge branches 'lt/crlf' and 'jc/apply-config'

* lt/crlf:
  Teach core.autocrlf to 'git apply'
  t0020: add test for auto-crlf
  Make AutoCRLF ternary variable.
  Lazy man's auto-CRLF

* jc/apply-config:
  t4119: test autocomputing -p<n> for traditional diff input.
  git-apply: guess correct -p<n> value for non-git patches.
  git-apply: notice "diff --git" patch again
  Fix botched "leak fix"
  t4119: add test for traditional patch and different p_value
  apply: fix memory leak in prefix_one()
  git-apply: require -p<n> when working in a subdirectory.
  git-apply: do not lose cwd when run from a subdirectory.
  Teach 'git apply' to look at $HOME/.gitconfig even outside of a repository
  Teach 'git apply' to look at $GIT_DIR/config

17 years agoMerge branch 'maint'
Junio C Hamano [Fri, 23 Feb 2007 05:27:37 +0000 (21:27 -0800)]
Merge branch 'maint'

* maint:
  git-diff: fix combined diff
  Fix 'git commit -a' in a newly initialized repository
  Include git-gui credits file in dist.
  Document the new core.bare configuration option.

17 years agogit-diff: fix combined diff
Johannes Schindelin [Fri, 23 Feb 2007 04:20:32 +0000 (05:20 +0100)]
git-diff: fix combined diff

The code forgets that typecast binds tighter than addition, in
other words:

    (cast *)array + i  === ((cast *)array) + i

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoFix 'git commit -a' in a newly initialized repository
Fredrik Kuivinen [Thu, 22 Feb 2007 20:28:12 +0000 (21:28 +0100)]
Fix 'git commit -a' in a newly initialized repository

With current git:

$ git init
$ git commit -a
cp: cannot stat `.git/index': No such file or directory

Output a nice error message instead.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoInclude git-gui credits file in dist.
Shawn O. Pearce [Thu, 22 Feb 2007 04:49:51 +0000 (23:49 -0500)]
Include git-gui credits file in dist.

The Makefile for the git-gui subproject will fail to execute if run
outside of a git.git directory, such as when building from a .tar.gz
or .tar.bz2.  This is because it is looking for the credits file,
which was created but omitted from the tarball by the toplevel
Makefile.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoDocument the new core.bare configuration option.
Shawn O. Pearce [Wed, 21 Feb 2007 22:59:08 +0000 (17:59 -0500)]
Document the new core.bare configuration option.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agot4119: test autocomputing -p<n> for traditional diff input.
Junio C Hamano [Thu, 22 Feb 2007 00:18:45 +0000 (16:18 -0800)]
t4119: test autocomputing -p<n> for traditional diff input.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-apply: guess correct -p<n> value for non-git patches.
Junio C Hamano [Thu, 22 Feb 2007 00:05:56 +0000 (16:05 -0800)]
git-apply: guess correct -p<n> value for non-git patches.

This enhances the third point in the previous commit.  When
applying a non-git patch that begins like this:

--- 2.6.orig/mm/slab.c
+++ 2.6/mm/slab.c
@@ -N,M +L,K @@@
...

and if you are in 'mm' subdirectory, we notice that -p2 is the
right option to use to apply the patch in file slab.c in the
current directory (i.e. mm/slab.c)

The guess function also knows about this pattern, where you
would need to use -p0 if applying from the top-level:

--- mm/slab.c
+++ mm/slab.c
@@ -N,M +L,K @@@
...

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-apply: notice "diff --git" patch again
Junio C Hamano [Wed, 21 Feb 2007 22:31:10 +0000 (14:31 -0800)]
git-apply: notice "diff --git" patch again

Earlier one that tried to be too consistent with GNU patch by
not stripping the leading path when we _know_ we are in a
subdirectory and the patch is relative to the toplevel was a
mistake.  This fixes it.

 - No change to behaviour when it is run from the toplevel of
   the repository.

 - When run from a subdirectory to apply a git-generated patch,
   it uses the right -p<n> value automatically, with or without
   --index nor --cached option.

 - When run from a subdirectory to apply a randomly generated
   patch, it wants the right -p<n> value to be given by the
   user.

The second one is a pure improvement to correct inconsistency
between --index and non --index case, compared with 1.5.0.  The
third point could be further improved to guess what the right
value for -p<n> should be by looking at the patch, but should be
a topic of a separate patch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'maint'
Junio C Hamano [Wed, 21 Feb 2007 19:16:20 +0000 (11:16 -0800)]
Merge branch 'maint'

* maint:
  Use gunzip -c over gzcat in import-tars example.
  git-gui: Don't crash in citool mode on initial commit.
  git-gui: Remove TODO list.
  git-gui: Include browser in our usage message.
  git-gui: Change summary of git-gui.
  git-gui: Display all authors of git-gui.
  git-gui: Use mixed path for docs on Cygwin.
  git-gui: Correct crash when saving options in blame mode.
  git-gui: Expose the browser as a subcommand.
  git-gui: Create new branches from a tag.
  git-gui: Prefer version file over git-describe.
  git-gui: Print version on the console.
  git-gui: More consistently display the application name.
  git-gui: Permit merging tags into the current branch.
  git-gui: Basic version check to ensure git 1.5.0 or later is used.
  git-gui: Refactor 'exec git subcmd' idiom.

17 years agoMerge branch 'master' of git://repo.or.cz/git-gui into maint
Junio C Hamano [Wed, 21 Feb 2007 19:09:57 +0000 (11:09 -0800)]
Merge branch 'master' of git://repo.or.cz/git-gui into maint

* 'master' of git://repo.or.cz/git-gui:
  git-gui: Don't crash in citool mode on initial commit.
  git-gui: Remove TODO list.
  git-gui: Include browser in our usage message.
  git-gui: Change summary of git-gui.
  git-gui: Display all authors of git-gui.
  git-gui: Use mixed path for docs on Cygwin.
  git-gui: Correct crash when saving options in blame mode.
  git-gui: Expose the browser as a subcommand.
  git-gui: Create new branches from a tag.
  git-gui: Prefer version file over git-describe.
  git-gui: Print version on the console.
  git-gui: More consistently display the application name.
  git-gui: Permit merging tags into the current branch.
  git-gui: Basic version check to ensure git 1.5.0 or later is used.
  git-gui: Refactor 'exec git subcmd' idiom.

17 years agoUse gunzip -c over gzcat in import-tars example.
Michael Loeffler [Wed, 14 Feb 2007 16:03:12 +0000 (17:03 +0100)]
Use gunzip -c over gzcat in import-tars example.

Not everyone has gzcat or bzcat installed on their system, but
gunzip -c and bunzip2 -c perform the same task and are available
if the user has installed gzip support or bzip2 support.

Signed-off-by: Michael Loeffler <zvpunry@zvpunry.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoFix botched "leak fix"
Junio C Hamano [Wed, 21 Feb 2007 08:58:18 +0000 (00:58 -0800)]
Fix botched "leak fix"

When (new_name == old_name), the previous one prefixed old_name
alone, leaving new_name untouched, and worse yet, left it
dangling pointing at an already freed memory location.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agot4119: add test for traditional patch and different p_value
Junio C Hamano [Wed, 21 Feb 2007 09:14:22 +0000 (01:14 -0800)]
t4119: add test for traditional patch and different p_value

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-remote: support remotes with a dot in the name
Pavel Roskin [Wed, 21 Feb 2007 05:03:36 +0000 (00:03 -0500)]
git-remote: support remotes with a dot in the name

[jc: the original from Pavel was limiting the variable names to only
 fetch and url, but I loosened it to take valid variable names.]

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoTeach diff -B about colours
Johannes Schindelin [Tue, 20 Feb 2007 14:08:46 +0000 (15:08 +0100)]
Teach diff -B about colours

Matthias Lederhofer noticed that `diff -B` did not pick up on diff
colournig.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoAllow git-remote to update named groups of remotes
Theodore Ts'o [Tue, 20 Feb 2007 20:13:43 +0000 (15:13 -0500)]
Allow git-remote to update named groups of remotes

In response to a feature request from Shawn Pearce, this patch allows
a user to update a named group of remotes by using "git remote update
<group>", where the group is defined in the config file by
remotes.<group>.  The default if the named group is not specified is
now fetched group remotes.default, instead of remote.fetch, which is
what had been previously used.

In addition, if remotes.default is not defined, all remotes defined in
the config file will be used, as before, but there is now also
possible to request that a particular repository to be skipped by
default by using the boolean configuration parameter
remote.<name>.skipDefaultUpdate.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoAdd config_boolean() method to the Git perl module
Theodore Ts'o [Tue, 20 Feb 2007 20:13:42 +0000 (15:13 -0500)]
Add config_boolean() method to the Git perl module

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoAllow passing of an alternative CVSROOT via -d.
Simon 'corecode' Schubert [Sun, 18 Feb 2007 17:17:08 +0000 (18:17 +0100)]
Allow passing of an alternative CVSROOT via -d.

This is necessary if using CVS in an asymmetric fashion, i.e. when the
CVSROOT you are checking out from differs from the CVSROOT you have to
commit to.

Signed-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agodisable t4016-diff-quote.sh on some filesystems
Alex Riesen [Tue, 20 Feb 2007 09:04:32 +0000 (10:04 +0100)]
disable t4016-diff-quote.sh on some filesystems

... because the filesystems (most typically FAT and NTFS) do not support
HT nor LF in filenames.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
17 years agoSupport for large files on 32bit systems.
Martin Waitz [Sat, 17 Feb 2007 09:13:10 +0000 (10:13 +0100)]
Support for large files on 32bit systems.

Glibc uses the same size for int and off_t by default.
In order to support large pack sizes (>2GB) we force Glibc to a 64bit off_t.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit grep: use pager
Johannes Schindelin [Mon, 19 Feb 2007 14:56:04 +0000 (15:56 +0100)]
git grep: use pager

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-gui: Don't crash in citool mode on initial commit. gitgui-0.6.1
Shawn O. Pearce [Wed, 21 Feb 2007 06:33:59 +0000 (01:33 -0500)]
git-gui: Don't crash in citool mode on initial commit.

Attempting to use `git citool` to create an initial commit caused
git-gui to crash with a Tcl error as it tried to add the newly
born branch to the non-existant branch menu.  Moving this code
to after the normal commit cleanup logic resolves the issue, as
we only have a branch menu if we are not in singlecommit mode.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-gui: Remove TODO list.
Shawn O. Pearce [Wed, 21 Feb 2007 06:29:05 +0000 (01:29 -0500)]
git-gui: Remove TODO list.

I'm apparently not very good at keeping my own TODO file current.
I its also somewhat strange to keep the TODO list as part of the
software branch, as its meta-information that is not directly
related to the code.  I'm pulling the TODO list from git-gui and
moving it into a seperate branch.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoMerge branch 'fk/autoconf'
Junio C Hamano [Wed, 21 Feb 2007 06:28:22 +0000 (22:28 -0800)]
Merge branch 'fk/autoconf'

* fk/autoconf:
  New autoconf test for iconv

17 years agogit-gui: Include browser in our usage message.
Shawn O. Pearce [Wed, 21 Feb 2007 06:24:57 +0000 (01:24 -0500)]
git-gui: Include browser in our usage message.

Now that the 'browser' subcommand can be used to startup the tree
browser, it should be listed as a possible subcommand option in
our usage message.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoMerge branch 'js/name-rev-fix'
Junio C Hamano [Wed, 21 Feb 2007 06:24:03 +0000 (22:24 -0800)]
Merge branch 'js/name-rev-fix'

* js/name-rev-fix:
  name-rev: avoid "^0" when unneeded

17 years agoprefixcmp(): fix-up leftover strncmp().
Junio C Hamano [Tue, 20 Feb 2007 09:55:07 +0000 (01:55 -0800)]
prefixcmp(): fix-up leftover strncmp().

There were instances of strncmp() that were formatted improperly
(e.g. whitespace around parameter before closing parenthesis)
that caused the earlier mechanical conversion step to miss
them.  This step cleans them up.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoprefixcmp(): fix-up mechanical conversion.
Junio C Hamano [Tue, 20 Feb 2007 09:54:00 +0000 (01:54 -0800)]
prefixcmp(): fix-up mechanical conversion.

Previous step converted use of strncmp() with literal string
mechanically even when the result is only used as a boolean:

    if (!strncmp("foo", arg, 3)) ==> if (!(-prefixcmp(arg, "foo")))

This step manually cleans them up to read:

    if (!prefixcmp(arg, "foo"))

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMechanical conversion to use prefixcmp()
Junio C Hamano [Tue, 20 Feb 2007 09:53:29 +0000 (01:53 -0800)]
Mechanical conversion to use prefixcmp()

This mechanically converts strncmp() to use prefixcmp(), but only when
the parameters match specific patterns, so that they can be verified
easily.  Leftover from this will be fixed in a separate step, including
idiotic conversions like

    if (!strncmp("foo", arg, 3))

  =>

    if (!(-prefixcmp(arg, "foo")))

This was done by using this script in px.perl

   #!/usr/bin/perl -i.bak -p
   if (/strncmp\(([^,]+), "([^\\"]*)", (\d+)\)/ && (length($2) == $3)) {
           s|strncmp\(([^,]+), "([^\\"]*)", (\d+)\)|prefixcmp($1, "$2")|;
   }
   if (/strncmp\("([^\\"]*)", ([^,]+), (\d+)\)/ && (length($1) == $3)) {
           s|strncmp\("([^\\"]*)", ([^,]+), (\d+)\)|(-prefixcmp($2, "$1"))|;
   }

and running:

   $ git grep -l strncmp -- '*.c' | xargs perl px.perl

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoAdd prefixcmp()
Junio C Hamano [Tue, 20 Feb 2007 09:51:22 +0000 (01:51 -0800)]
Add prefixcmp()

We have too many strncmp(a, b, strlen(b)).

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'maint'
Junio C Hamano [Wed, 21 Feb 2007 06:02:15 +0000 (22:02 -0800)]
Merge branch 'maint'

* maint:
  Check for PRIuMAX rather than NO_C99_FORMAT in fast-import.c.

17 years agogit-gui: Change summary of git-gui.
Shawn O. Pearce [Mon, 19 Feb 2007 02:08:04 +0000 (21:08 -0500)]
git-gui: Change summary of git-gui.

Since git-gui does more than create commits, it is unfair to call
it "a commit creation tool".  Instead lets just call it a graphical
user interface.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-gui: Display all authors of git-gui.
Shawn O. Pearce [Mon, 19 Feb 2007 02:06:48 +0000 (21:06 -0500)]
git-gui: Display all authors of git-gui.

Now that git-gui has been released to the public as part of Git 1.5.0
I am starting to see some work from other people beyond myself and
Paul.  Consequently the copyright for git-gui is not strictly the
two of us anymore, and these others deserve to have some credit
given to them.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-gui: Use mixed path for docs on Cygwin.
Shawn O. Pearce [Mon, 19 Feb 2007 00:06:09 +0000 (19:06 -0500)]
git-gui: Use mixed path for docs on Cygwin.

The Firefox browser requires that a URL use / to delimit directories.
This is instead of \, as \ gets escaped by the browser into its hex
escape code and then relative URLs are incorrectly resolved, Firefox
no longer sees the directories for what they are.  Since we are
handing the browser a true URL, we better use the standard / for
directories.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoCheck for PRIuMAX rather than NO_C99_FORMAT in fast-import.c.
Jason Riedy [Wed, 21 Feb 2007 01:34:56 +0000 (17:34 -0800)]
Check for PRIuMAX rather than NO_C99_FORMAT in fast-import.c.

Thanks to Simon 'corecode' Schubert <corecode@fs.ei.tum.de> for
the clean-up.  Defining the C99 standard PRIuMAX when necessary
replaces UM_FMT and the awkward UM10_FMT.  There are no direct
C99 translations for other uses of NO_C99_FORMAT in git, alas.

Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoLink 1.5.0.1 documentation from the main page.
Junio C Hamano [Tue, 20 Feb 2007 08:44:35 +0000 (00:44 -0800)]
Link 1.5.0.1 documentation from the main page.

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoname-rev: avoid "^0" when unneeded
Johannes Schindelin [Tue, 20 Feb 2007 00:08:48 +0000 (01:08 +0100)]
name-rev: avoid "^0" when unneeded

When naming by a tag, we used to add "^0" even if this was not really
necessary. For example, `git name-rev de6f0def` now outputs

de6f0def tags/v1.5.0.1~9

instead of

de6f0def tags/v1.5.0.1^0~9

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoapply: fix memory leak in prefix_one()
Johannes Schindelin [Tue, 20 Feb 2007 02:45:49 +0000 (03:45 +0100)]
apply: fix memory leak in prefix_one()

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-apply: require -p<n> when working in a subdirectory.
Junio C Hamano [Tue, 20 Feb 2007 01:57:29 +0000 (17:57 -0800)]
git-apply: require -p<n> when working in a subdirectory.

git-apply running inside a subdirectory, with or without --index,
used to always assume that the patch is formatted in such a way
to apply with -p1 from the toplevel, but it is more useful and
consistent with the use of "GNU patch -p1" if it defaulted to
assume that its input is meant to apply at the level it is
invoked in.

This changes the behaviour.  It used to be that the patch
generated this way would apply without any trick:

edit Documentation/Makefile
git diff >patch.file
cd Documentation
git apply ../patch.file

You need to give an explicit -p2 to git-apply now.  On the other
hand, if you got a patch from somebody else who did not follow
"patch is to apply from the top with -p1" convention, the input
patch would start with:

diff -u Makefile.old Makefile
--- Makefile.old
+++ Makefile

and in such a case, you can apply it with:

git apply -p0 patch.file

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-apply: do not lose cwd when run from a subdirectory.
Junio C Hamano [Tue, 20 Feb 2007 01:58:58 +0000 (17:58 -0800)]
git-apply: do not lose cwd when run from a subdirectory.

When a patch modifies (not deletes) the last file in a
directory, because we treat a modification just as deletion
followed by creation, and deleting the last file in a directory
automatically rmdir(2)'s that directory, we ended up removing
the directory, which can potentially be the cwd, and then
recreating the same directory to create the patch result.

Avoid the rmdir step when remove_file() is called only because
we are replacing it with the result by later calling
create_file().

Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoTeach git-remote to update existing remotes by fetching from them
Theodore Ts'o [Mon, 19 Feb 2007 04:00:00 +0000 (23:00 -0500)]
Teach git-remote to update existing remotes by fetching from them

This allows users to use the command "git remote update" to update all
remotes that are being tracked in the repository.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'js/diff-color-check'
Junio C Hamano [Tue, 20 Feb 2007 02:30:59 +0000 (18:30 -0800)]
Merge branch 'js/diff-color-check'

* js/diff-color-check:
  diff --check: use colour

17 years agoMerge branch 'jc/fetch-notags'
Junio C Hamano [Tue, 20 Feb 2007 02:30:52 +0000 (18:30 -0800)]
Merge branch 'jc/fetch-notags'

* jc/fetch-notags:
  remotes.not-origin.tagopt

17 years agoMerge branch 'maint'
Junio C Hamano [Tue, 20 Feb 2007 02:29:41 +0000 (18:29 -0800)]
Merge branch 'maint'

* maint:
  Obey NO_C99_FORMAT in fast-import.c.
  Add a compat/strtoumax.c for Solaris 8.
  git-clone: Sync documentation to usage note.

17 years agoObey NO_C99_FORMAT in fast-import.c.
Jason Riedy [Tue, 20 Feb 2007 00:27:09 +0000 (16:27 -0800)]
Obey NO_C99_FORMAT in fast-import.c.

Define UM_FMT and UM10_FMT and use in place of %ju and %10ju,
respectively.  Both format as unsigned long long, so this
assumes the compiler supports long long.

Signed-off-by: Jason Riedy <jason@acm.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoAdd a compat/strtoumax.c for Solaris 8.
Jason Riedy [Tue, 20 Feb 2007 00:22:56 +0000 (16:22 -0800)]
Add a compat/strtoumax.c for Solaris 8.

Solaris 8 was pre-c99, and they weren't willing to commit to
the strtoumax definition according to /usr/include/inttypes.h.

This adds NO_STRTOUMAX and NO_STRTOULL for ancient systems.
If NO_STRTOUMAX is defined, the routine in compat/strtoumax.c
will be used instead.  That routine passes its arguments to
strtoull unless NO_STRTOULL is defined.  If NO_STRTOULL, then
the routine uses strtoul (unsigned long).

Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
Acked-by: Shawn O Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agogit-clone: Sync documentation to usage note.
Christian Schlotter [Mon, 19 Feb 2007 12:35:35 +0000 (13:35 +0100)]
git-clone: Sync documentation to usage note.

Documentation advertises the new `--depth <n>' parameter with an equal
sign, while the usage notes (shown after `git-clone --help') do not.  If I
understood git-clone's source code correctly, the version without the
equal sign is correct, which is why this patch syncs documentation to the
usage note.

Signed-off-by: Christian Schlotter <schlotter@users.sourceforge.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoMerge branch 'ap/cvsserver'
Junio C Hamano [Mon, 19 Feb 2007 21:11:05 +0000 (13:11 -0800)]
Merge branch 'ap/cvsserver'

* ap/cvsserver:
  Have git-cvsserver call hooks/update before really altering the ref

Acked-by: Martin Langhoff <martin@catalyst.net.nz>
17 years agoMerge branch 'maint'
Junio C Hamano [Mon, 19 Feb 2007 02:45:52 +0000 (18:45 -0800)]
Merge branch 'maint'

* maint:
  GIT 1.5.0.1
  Documentation/i18n.txt: it is i18n.commitencoding not core.commitencoding
  Read the config in rev-list

Conflicts:

RelNotes