1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-01 14:57:52 +01:00
Commit graph

958 commits

Author SHA1 Message Date
Junio C Hamano
e25cfae667 contrib: resurrect scripted git-revert.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-26 17:38:00 -08:00
Jeff King
718a087a47 teach bash completion to treat commands with "--" as a helper
There is a convention that commands containing a double-dash
are implementation details and not to be used by mortals. We
should automatically remove them from the completion
suggestions as such.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 11:55:48 -08:00
Alexandre Julliard
18ff365fcb git.el: Added a menu for git-status-mode.
Originally written by Rémi Vanicat, I just changed the layout a little.

Signed-off-by: Rémi Vanicat <vanicat@debian.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-11 09:55:21 -08:00
Junio C Hamano
90e0653b18 hg-to-git: handle an empty dir in hg.
Mark Drago had a subversion repository which was then converted to hg
and now is moving in to git.  The first commit in the svn repo was
just the creation of the empty directory.  This made its way in to the
hg repository fine, but converting from hg to git would cause an
error.  The problem was that hg-to-git.py tries to commit the change,
git-commit fails, and then hg-to-git.py tries to checkout the new
revision and that fails (because it was not created).  This may have
only caused an error because it was the first commit in the
repository.  If an empty directory was added in the middle of the repo
somewhere things might have worked out fine.

This patch will use the new --allow-empty option to git-commit to
record such an "empty" commit, to reproduce the history recorded in hg
more faithfully.

Tested-by: Mark Drago <markdrago@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06 07:26:29 -08:00
Junio C Hamano
31cbb5d961 Merge branch 'kh/commit'
* kh/commit: (33 commits)
  git-commit --allow-empty
  git-commit: Allow to amend a merge commit that does not change the tree
  quote_path: fix collapsing of relative paths
  Make git status usage say git status instead of git commit
  Fix --signoff in builtin-commit differently.
  git-commit: clean up die messages
  Do not generate full commit log message if it is not going to be used
  Remove git-status from list of scripts as it is builtin
  Fix off-by-one error when truncating the diff out of the commit message.
  builtin-commit.c: export GIT_INDEX_FILE for launch_editor as well.
  Add a few more tests for git-commit
  builtin-commit: Include the diff in the commit message when verbose.
  builtin-commit: fix partial-commit support
  Fix add_files_to_cache() to take pathspec, not user specified list of files
  Export three helper functions from ls-files
  builtin-commit: run commit-msg hook with correct message file
  builtin-commit: do not color status output shown in the message template
  file_exists(): dangling symlinks do exist
  Replace "runstatus" with "status" in the tests
  t7501-commit: Add test for git commit <file> with dirty index.
  ...
2007-12-04 17:16:33 -08:00
Jakub Narebski
afa75bc8aa contrib: Make remotes2config.sh script more robust
The remotes2config.sh script replaced all 'unsafe' characters in repo
name with '.'; include '-' in the 'safe' characters set (the set is
probably even larger).

Script required also space after "URL:", "Push:" and "Pull:" in
remotes file. This for example made the following remote
  URL: git://git.kernel.org/pub/scm/git/git.git
  Pull: refs/heads/master:refs/heads/origin
  Pull:+refs/heads/pu:refs/heads/pu
miss 'pu' branch (forced branch) in config file after conversion.
Allow for any number of whitespace after "URL:", "Push:", "Pull:".

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-04 14:35:08 -08:00
Junio C Hamano
d25430c5f8 Merge branch 'maint'
* maint:
  scripts: do not get confused with HEAD in work tree
  Improve description of git-branch -d and -D in man page.
2007-11-28 17:06:57 -08:00
Johannes Schindelin
b3a4f8586b bash completion: add diff options
I use "git diff" (the porcelain) really often, and am almost as often
annoyed that the completions do not know how to complete something simple
as --cached.  Now they do.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 16:20:31 -08:00
Junio C Hamano
fd200790dc Merge branch 'jk/send-pack'
* jk/send-pack: (24 commits)
  send-pack: cluster ref status reporting
  send-pack: fix "everything up-to-date" message
  send-pack: tighten remote error reporting
  make "find_ref_by_name" a public function
  Fix warning about bitfield in struct ref
  send-pack: assign remote errors to each ref
  send-pack: check ref->status before updating tracking refs
  send-pack: track errors for each ref
  git-push: add documentation for the newly added --mirror mode
  Add tests for git push'es mirror mode
  Update the tracking references only if they were succesfully updated on remote
  Add a test checking if send-pack updated local tracking branches correctly
  git-push: plumb in --mirror mode
  Teach send-pack a mirror mode
  send-pack: segfault fix on forced push
  Reteach builtin-ls-remote to understand remotes
  send-pack: require --verbose to show update of tracking refs
  receive-pack: don't mention successful updates
  more terse push output
  Build in ls-remote
  ...
2007-11-24 16:45:37 -08:00
Junio C Hamano
6c6ea3800d Merge branch 'sb/clean'
* sb/clean:
  Teach git clean to use setup_standard_excludes()
  git-clean: Fix error message if clean.requireForce is not set.
  Make git-clean a builtin
2007-11-24 16:31:34 -08:00
Kristian Høgsberg
f5bbc3225c Port git commit to C.
This makes git commit a builtin and moves git-commit.sh to
contrib/examples.  This also removes the git-runstatus
helper, which was mostly just a git-status.sh implementation detail.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:02 -08:00
Thomas Harning
a00a42ae33 git-merge-ours: make it a builtin.
Except that this fixes a longstanding corner case bug by
tightening the way underlying diff-index command is run, it is
functionally equivalent to the scripted version.

Signed-off-by: Thomas Harning Jr <harningt@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 14:21:59 -08:00
Shun Kei Leung
183f84365d git-p4: Fix typo in --detect-labels
Signed-off-by: Kevin Leung <kevinlsk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-20 23:27:44 -08:00
Anton Gyllenberg
59adeef48f gitview: import only one of gtksourceview and gtksourceview2
Importing both gtksourceview and gtksourceview2 will make python segfault
on my system (ubuntu 7.10). Change so that gtksourceview is only imported
if importing gtksourceview2 fails. This should be safe as gtksourceview
is only used if gtksourceview2 is not available.

Signed-off-by: Anton Gyllenberg <anton@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-19 23:24:34 -08:00
Shawn Bohrer
113f10f22f Make git-clean a builtin
This replaces git-clean.sh with builtin-clean.c, and moves
git-clean.sh to the examples.

This also introduces a change in behavior when removing directories
explicitly specified as a path.  For example currently:

1. When dir has only untracked files, these two behave differently:

    $ git clean -n dir
    $ git clean -n dir/

the former says "Would not remove dir/", while the latter would say
"Would remove dir/untracked" for all paths under it, but not the
directory itself.

With -d, the former would stop refusing, however since the user
explicitly asked to remove the directory the -d is no longer required.

2. When there are more parameters:

    $ git clean -n dir foo
    $ git clean -n dir/ foo

both cases refuse to remove dir/ unless -d is specified.  Once again
since both cases requested to remove dir the -d is no longer required.

Thanks to Johannes Schindelin for the conversion to using the
parse-options API.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-18 19:11:42 -08:00
Simon Hausmann
38f9f5ec41 git-p4: Fix direct import from perforce after fetching changes through git from origin
When using an existing git repository to cache the perforce import we don't
fetch the branch mapping from perforce as that is a slow operation. However
the origin repository may not be fully up-to-date and therefore it may be
necessary to import more changes directly from Perforce.

Such a direct import needs self.knownBranches to be set up though, so
initialize it from the existing p4/* git branches.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-16 01:32:59 -08:00
Junio C Hamano
a108e53861 Merge branch 'db/remote-builtin' into jk/send-pack
* db/remote-builtin:
  Reteach builtin-ls-remote to understand remotes
  Build in ls-remote
  Use built-in send-pack.
  Build-in send-pack, with an API for other programs to call.
  Build-in peek-remote, using transport infrastructure.
  Miscellaneous const changes and utilities

Conflicts:

	transport.c
2007-11-14 03:09:52 -08:00
Gerrit Pape
5c355059c3 contrib/hooks/post-receive-email: remove cruft, $committer is not used
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-08 14:18:13 -08:00
Junio C Hamano
7481ebe991 Merge branch 'cp/p4'
* cp/p4:
  git-p4: Detect changes to executable bit and include them in p4 submit.
  git-p4: Add a helper function to parse the full git diff-tree output.
2007-11-07 18:16:18 -08:00
Gerrit Pape
e7509ee388 contrib/hooks/post-receive-email: make subject prefix configurable
Email subjects are prefixed with "[SCM] " by default, make this optionally
configurable through the hooks.emailprefix config option.

Suggested by martin f krafft through
 http://bugs.debian.org/428418

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-07 16:45:31 -08:00
Gerrit Pape
15a2f53011 contrib/hooks/post-receive-email: reformat to wrap comments at 76 chars
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-07 16:45:31 -08:00
Gerrit Pape
b5786c8283 contrib/hooks/post-receive-email: fix typo
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-07 16:45:31 -08:00
Daniel Barkalow
8951d7c1f1 Build in ls-remote
This actually replaces peek-remote with ls-remote, since peek-remote
now handles everything. peek-remote remains an a second name for
ls-remote, although its help message now gives the "ls-remote" name.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 12:25:42 -08:00
Chris Pettitt
c65b670e85 git-p4: Detect changes to executable bit and include them in p4 submit.
This changeset takes advantage of the new parseDiffTreeEntry(...) function to
detect changes to the execute bit in the git repository.  During submit, git-p4
now looks for changes to the executable bit and if it finds them it "reopens"
the file in perforce, which allows it to change the file type.

The logic for adding the executable bit in perforce is straightforward: the +x
modifier can be used. Removing the executable bit in perforce requires that the
entire filetype be redefined (there is no way to join remove the bit with a -x
modifier, for example). This changeset includes logic to remove the executable
bit from the full file type while preserving the base file type and other
modifiers.

Signed-off-by: Chris Pettitt <cpettitt@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-02 02:01:32 -07:00
Chris Pettitt
b43b0a3c5c git-p4: Add a helper function to parse the full git diff-tree output.
Signed-off-by: Chris Pettitt <cpettitt@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-02 02:01:32 -07:00
Gerrit Pape
fee9832a8d No longer install git-svnimport, move to contrib/examples
This has been proposed for a few times without much reaction
from the list.  Actually remove it to see who screams.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-30 21:36:29 -07:00
Alexandre Julliard
d53a35020d git.el: Run git-gc --auto after commits.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-28 14:08:28 -07:00
Alexandre Julliard
2f6e86a86f git.el: Refresh only the changed file marks when marking/unmarking all.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-28 14:08:28 -07:00
Alexandre Julliard
6df023884b git.el: Fix typo in git-update-saved-file error handling.
Spotted by Matthieu Lemerre.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-28 14:08:28 -07:00
Alexandre Julliard
3697c5f37a git.el: Fix typo in "Reverted file" message.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-28 14:08:28 -07:00
Junio C Hamano
d90a7fda35 Merge branch 'db/fetch-pack'
* db/fetch-pack: (60 commits)
  Define compat version of mkdtemp for systems lacking it
  Avoid scary errors about tagged trees/blobs during git-fetch
  fetch: if not fetching from default remote, ignore default merge
  Support 'push --dry-run' for http transport
  Support 'push --dry-run' for rsync transport
  Fix 'push --all branch...' error handling
  Fix compilation when NO_CURL is defined
  Added a test for fetching remote tags when there is not tags.
  Fix a crash in ls-remote when refspec expands into nothing
  Remove duplicate ref matches in fetch
  Restore default verbosity for http fetches.
  fetch/push: readd rsync support
  Introduce remove_dir_recursively()
  bundle transport: fix an alloc_ref() call
  Allow abbreviations in the first refspec to be merged
  Prevent send-pack from segfaulting when a branch doesn't match
  Cleanup unnecessary break in remote.c
  Cleanup style nit of 'x == NULL' in remote.c
  Fix memory leaks when disconnecting transport instances
  Ensure builtin-fetch honors {fetch,transfer}.unpackLimit
  ...
2007-10-24 21:59:50 -07:00
Chris Pettitt
d9a5f25b67 git-p4 support for perforce renames.
The current git-p4 implementation does support file renames. However, because
it does not use the "p4 integrate" command, the history for the renamed file is
not linked to the new file.

This changeset adds support for perforce renames with the integrate command.
Currently this feature is only enabled when calling git-p4 submit with the -M
option. This is intended to look and behave similar to the "detect renames"
feature of other git commands.

The following sequence is used for renamed files:

    p4 integrate -Dt x x'
    p4 edit x'
    rm x'
    git apply
    p4 delete x

By default, perforce will not allow an integration with a target file that has
been deleted. That is, if x' in the example above is the name of a previously
deleted file then perforce will fail the integrate. The -Dt option tells
perforce to allow the target of integrate to be a previously deleted file.

Signed-off-by: Chris Pettitt <cpettitt@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-10-20 17:12:16 +02:00
Simon Hausmann
209471493a git-p4: When skipping a patch as part of "git-p4 submit" make sure we correctly revert to the previous state of the files using "p4 revert".
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-10-20 17:12:02 +02:00
Shawn O. Pearce
e75c55844f Merge branch 'maint'
* maint:
  Yet more 1.5.3.5 fixes mentioned in release notes
  cvsserver: Use exit 1 instead of die when req_Root fails.
  git-blame shouldn't crash if run in an unmerged tree
  git-config: print error message if the config file cannot be read
  fixing output of non-fast-forward output of post-receive-email
2007-10-18 03:11:17 -04:00
Robert Schiele
a2d6b872db fixing output of non-fast-forward output of post-receive-email
post-receive-email has one place where the variable fast_forward is not
spelled correctly.  At the same place the logic was reversed.  The
combination of both bugs made the script work correctly for fast-forward
commits but not for non-fast-forward ones.  This change fixes this to
be correct in both cases.

Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-18 00:59:25 -04:00
Shawn O. Pearce
2e13e5d892 Merge branch 'master' into db/fetch-pack
There's a number of tricky conflicts between master and
this topic right now due to the rewrite of builtin-push.
Junio must have handled these via rerere; I'd rather not
deal with them again so I'm pre-merging master into the
topic.  Besides this topic somehow started to depend on
the strbuf series that was in next, but is now in master.
It no longer compiles on its own without the strbuf API.

* master: (184 commits)
  Whip post 1.5.3.4 maintenance series into shape.
  Minor usage update in setgitperms.perl
  manual: use 'URL' instead of 'url'.
  manual: add some markup.
  manual: Fix example finding commits referencing given content.
  Fix wording in push definition.
  Fix some typos, punctuation, missing words, minor markup.
  manual: Fix or remove em dashes.
  Add a --dry-run option to git-push.
  Add a --dry-run option to git-send-pack.
  Fix in-place editing functions in convert.c
  instaweb: support for Ruby's WEBrick server
  instaweb: allow for use of auto-generated scripts
  Add 'git-p4 commit' as an alias for 'git-p4 submit'
  hg-to-git speedup through selectable repack intervals
  git-svn: respect Subversion's [auth] section configuration values
  gtksourceview2 support for gitview
  fix contrib/hooks/post-receive-email hooks.recipients error message
  Support cvs via git-shell
  rebase -i: use diff plumbing instead of porcelain
  ...

Conflicts:

	Makefile
	builtin-push.c
	rsh.c
2007-10-16 00:15:25 -04:00
Josh England
03618b9df8 Minor usage update in setgitperms.perl
Signed-off-by: Josh England <jjengla@sandia.gov>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 22:11:54 -04:00
Marius Storm-Olsen
a9834f5833 Add 'git-p4 commit' as an alias for 'git-p4 submit'
Given that git uses 'commit', git-p4's 'sumbit' was a bit confusing at times;
often making me do 'git submit' and 'git-p4 commit' instead.

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Acked-By: Simon Hausmann <simon@lst.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 21:30:31 -04:00
Michael Gebetsroither
7c0d741a3e hg-to-git speedup through selectable repack intervals
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 21:30:00 -04:00
Frederick Akalin
24ccd8b88e gtksourceview2 support for gitview
Added support for gtksourceview2 module (pygtksourceview 1.90.x) in
gitview.  Also refactored code that creates the source buffer and view.

Signed-off-by: Frederick Akalin <akalin@akalin.cx>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 21:27:41 -04:00
Jeff Muizelaar
fdfeb87c14 fix contrib/hooks/post-receive-email hooks.recipients error message
Have the error message for missing recipients actually report the
missing config variable and not a fictional one.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 21:26:42 -04:00
Junio C Hamano
34c6dbdef4 Merge branch 'maint'
* maint:
  Whip post 1.5.3.3 maintenance series into shape.
  git stash: document apply's --index switch
  post-receive-hook: Remove the From field from the generated email header so that the pusher's name is used
2007-10-01 02:09:09 -07:00
Andy Parkins
e6dc8d60fb post-receive-hook: Remove the From field from the generated email header so that the pusher's name is used
Using the name of the committer of the revision at the tip of the
updated ref is not sensible.  That information is available in the email
itself should it be wanted, and by supplying a "From", we were
effectively hiding the person who performed the push - which is useful
information in itself.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-01 01:59:22 -07:00
Alexandre Julliard
72dc52bfe6 git.el: Reset the permission flags when changing a file state.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:44:06 -07:00
Alexandre Julliard
0365d885ad git.el: Update a file status in the git buffer upon save.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:44:05 -07:00
Alexandre Julliard
9f5599b982 git.el: Do not print a status message on every git command.
Instead print a single message around sequences of commands that can
potentially take some time.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:44:05 -07:00
Alexandre Julliard
b9b7bab4b6 git.el: Preserve file marks when doing a full refresh.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:44:05 -07:00
Matt Kraai
2ecb5ea2ad Move convert-objects to contrib.
convert-objects was needed to convert from an old-style repository,
which hashed the compressed contents and used a different date format.
Such repositories are presumably no longer common and, if such
conversions are necessary, should be done by writing a frontend for
git-fast-import.

Linus, the original author, is OK with moving it to contrib.

Signed-off-by: Matt Kraai <kraai@ftbfs.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-25 17:34:12 -07:00
Junio C Hamano
41ef95aea7 Merge branch 'maint'
* maint:
  Do not over-quote the -f envelopesender value.
  unexpected Make output (e.g. from --debug) causes build failure
  Fixed minor typo in t/t9001-send-email.sh test command line.
2007-09-25 00:30:33 -07:00
Jim Meyering
d1637a07f6 Do not over-quote the -f envelopesender value.
Without this, the value passed to sendmail would have an extra set of
single quotes.  At least exim's sendmail emulation would object to that:

    exim: bad -f address "'list-addr@example.org'": malformed address: ' \
      may not follow 'list-addr@example.org
    error: hooks/post-receive exited with error code 1

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-25 00:30:19 -07:00
Junio C Hamano
91d4b2ee81 Merge branch 'je/hooks'
* je/hooks:
  Added example hook script to save/restore permissions/ownership.
  Add post-merge hook, related documentation, and tests.
2007-09-23 22:51:03 -07:00
Junio C Hamano
4f337e2466 Merge branch 'maint'
* maint:
  git-svn: don't attempt to spawn pager if we don't want one
  Supplant the "while case ... break ;; esac" idiom
  User Manual: add a chapter for submodules
  user-manual: don't assume refs are stored under .git/refs
  Detect exec bit in more cases.
  Conjugate "search" correctly in the git-prune-packed man page.
  Move the paragraph specifying where the .idx and .pack files should be
  Documentation/git-lost-found.txt: drop unnecessarily duplicated name.
2007-09-23 17:13:55 -07:00
David Kastrup
822f7c7349 Supplant the "while case ... break ;; esac" idiom
A lot of shell scripts contained stuff starting with

	while case "$#" in 0) break ;; esac

and similar.  I consider breaking out of the condition instead of the
body od the loop ugly, and the implied "true" value of the
non-matching case is not really obvious to humans at first glance.  It
happens not to be obvious to some BSD shells, either, but that's
because they are not POSIX-compliant.  In most cases, this has been
replaced by a straight condition using "test".  "case" has the
advantage of being faster than "test" on vintage shells where "test"
is not a builtin.  Since none of them is likely to run the git
scripts, anyway, the added readability should be worth the change.

A few loops have had their termination condition expressed
differently.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-23 16:12:00 -07:00
David Brown
b9fc6ea9ef Detect exec bit in more cases.
git-p4 was missing the execute bit setting if the file had other attribute
bits set.

Acked-By: Simon Hausmann <simon@lst.de>
2007-09-22 15:41:50 -07:00
Daniel Barkalow
b888d61c83 Make fetch a builtin
Thanks to Johannes Schindelin for review and fixes, and Julian
Phillips for the original C translation.

This changes a few small bits of behavior:

branch.<name>.merge is parsed as if it were the lhs of a fetch
refspec, and does not have to exactly match the actual lhs of a
refspec, so long as it is a valid abbreviation for the same ref.

branch.<name>.merge is no longer ignored if the remote is configured
with a branches/* file. Neither behavior is useful, because there can
only be one ref that gets fetched, but this is more consistant.

Also, fetch prints different information to standard out.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-19 03:22:30 -07:00
Josh England
af6fb4c822 Added example hook script to save/restore permissions/ownership.
Usage info is emebed in the script, but the gist of it is to run the script
from a pre-commit hook to save permissions/ownership data to a file and check
that file into the repository.  Then, a post_merge hook reads the file and
updates working tree permissions/ownership.  All updates are transparent to
the user (although there is a --verbose option).  Merge conflicts are handled
in the "read" phase (in pre-commit), and the script aborts the commit and
tells you how to fix things in the case of a merge conflict in the metadata
file.  This same idea could be extended to handle file ACLs or other file
metadata if desired.

Signed-off-by: Josh England <jjengla@sandia.gov>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-18 17:40:24 -07:00
Jeff King
e349026812 contrib/fast-import: add perl version of simple example
This is based on the git-import.sh script, but is a little
more robust and efficient. More importantly, it should
serve as a quick template for interfacing fast-import with
perl scripts.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-18 03:14:18 -07:00
Nguyen Thai Ngoc Duy
7f8cfadf21 contrib/fast-import: add simple shell example
This example just puts a directory under git control. It is
significantly slower than using the git tools directly, but
hopefully shows a bit how fast-import works.

  [jk: added header comments]

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-18 03:14:16 -07:00
Junio C Hamano
58f6fb53dd Merge branch 'jc/cachetree' into cr/reset
* jc/cachetree:
  Simplify cache API
  git-format-patch --in-reply-to: accept <message@id> with angle brackets
  git-add -u: do not barf on type changes
  Remove duplicate note about removing commits with git-filter-branch
  git-clone: improve error message if curl program is missing or not executable
  git.el: Allow the add and remove commands to be applied to ignored files.
  git.el: Allow selecting whether to display uptodate/unknown/ignored files.
  git.el: Keep the status buffer sorted by filename.
  hooks--update: Explicitly check for all zeros for a deleted ref.
2007-09-14 01:19:30 -07:00
Alexandre Julliard
568d2cde9b git.el: Allow the add and remove commands to be applied to ignored files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-13 22:37:54 -07:00
Alexandre Julliard
98acc3fabc git.el: Allow selecting whether to display uptodate/unknown/ignored files.
The default behavior for each state can be customized, and it can also
be toggled directly from the status buffer.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-13 22:37:54 -07:00
Alexandre Julliard
1b655040be git.el: Keep the status buffer sorted by filename.
This makes insertions and updates much more efficient.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-13 22:36:22 -07:00
Carlos Rica
0e5a7faa3a Make "git reset" a builtin.
This replaces the script "git-reset.sh" with "builtin-reset.c".

A few git commands used in the script are called from the builtin also:
"ls-files" to check for unmerged files, "read-tree" for resetting
the index file in "mixed" and "hard" resets, and "update-index" to
refresh at the end in the "mixed" reset and also for the option that
gets selected paths into the index.

The reset option with paths was implemented by Johannes Schindelin.

Since the option that gets selected paths into the index is not
a "reset" like the others because it does not change the HEAD at all,
now the command is showing a warning when the "--mixed" option
is supplied for that purpose.

The following table shows the behaviour of "git reset" for
the different supported options, where X means "changing"
the HEAD, index or working tree:

reset:  --soft  --mixed  --hard  -- <paths>
HEAD       X       X        X        -
index      -       X        X        X
files      -       -        X        -

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-12 13:25:07 -07:00
Junio C Hamano
b5ef6ac978 Merge branch 'master' of git://repo.or.cz/git/git-p4
* 'master' of git://repo.or.cz/git/git-p4:
  git-p4: Added support for automatically importing newly appearing perforce branches.
  git-p4: Cleanup; moved the (duplicated) code for turning a branch into a git ref (for example foo -> refs/remotes/p4/<project>/foo) into a separate method.
  git-p4: Cleanup; moved the code for the initial #head or revision import into a separate function, out of P4Sync.run.
  git-p4: Cleanup; Turn self.revision into a function local variable (it's not used anywhere outside the function).
  git-p4: Cleanup; moved the code to import a list of p4 changes using fast-import into a separate member function of P4Sync.
  git-p4: Cleanup; moved the code for getting a sorted list of p4 changes for a list of given depot paths into a standalone method.
  git-p4: After submission to p4 always synchronize from p4 again (into refs/remotes). Whether to rebase HEAD or not is still left as question to the end-user.
  git-p4: Always call 'p4 sync ...' before submitting to Perforce.
2007-09-06 00:05:49 -07:00
Shawn O. Pearce
ea09ea22d6 Don't allow contrib/workdir/git-new-workdir to trash existing dirs
Recently I found that doing a sequence like the following:

  git-new-workdir a b
  ...
  git-new-workdir a b

by accident will cause a (and now also b) to have an infinite cycle
in its refs directory.  This is caused by git-new-workdir trying
to create the "refs" symlink over again, only during the second
time it is being created within a's refs directory and is now also
pointing back at a's refs.

This causes confusion in git as suddenly branches are named things
like "refs/refs/refs/refs/refs/refs/refs/heads/foo" instead of the
more commonly accepted "refs/heads/foo".  Plenty of commands start
to see ambiguous ref names and others just take ages to compute.

git-clone has the same safety check, so git-new-workdir should
behave just like it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 22:24:54 -07:00
Simon Hausmann
1ca3d71069 git-p4: Added support for automatically importing newly appearing perforce branches.
If a change in a p4 "branch" appears that hasn't seen any previous commit and
that has a known branch mapping we now try to import it properly. First we
find the p4 change of the source branch that the new p4 branch is based on. Then
we using git rev-list --bisect to locate the corresponding git commit to that change.
Finally we import all changes in the new p4 branch up to the current change and resume
with the regular import.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:39 +02:00
Simon Hausmann
8134f69c21 git-p4: Cleanup; moved the (duplicated) code for turning a branch into a git ref (for example foo -> refs/remotes/p4/<project>/foo) into a separate method.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:37 +02:00
Simon Hausmann
c208a24310 git-p4: Cleanup; moved the code for the initial #head or revision import into a separate function, out of P4Sync.run.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:25 +02:00
Simon Hausmann
1c49fc197b git-p4: Cleanup; Turn self.revision into a function local variable (it's not used anywhere outside the function).
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:13 +02:00
Simon Hausmann
e87f37ae42 git-p4: Cleanup; moved the code to import a list of p4 changes using fast-import into a separate member function of P4Sync.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:34:56 +02:00
Simon Hausmann
4f6432d8cc git-p4: Cleanup; moved the code for getting a sorted list of p4 changes for a list of given depot paths into a standalone method.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:34:32 +02:00
Simon Hausmann
14594f4b57 git-p4: After submission to p4 always synchronize from p4 again (into refs/remotes). Whether to rebase HEAD or not is still left as question to the end-user.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:27:02 +02:00
Simon Hausmann
31f9ec129e git-p4: Always call 'p4 sync ...' before submitting to Perforce.
Acked-by: Marius Storm-Olsen <marius@trolltech.com>
Acked-by: Thiago Macieira <thiago@kde.org>
2007-09-03 20:27:02 +02:00
Shawn O. Pearce
88e21dc746 Teach bash about completing arguments for git-tag
Lately I have been doing a lot of calls to `git tag -d` and also to
`git tag -v`.  In both such cases being able to complete the names
of existing tags saves the fingers some typing effort.  We now look
for the -d or -v option to git-tag in the bash completion support
and offer up existing tag names as possible choices for these.

When creating a new tag we now also offer bash completion support
for the second argument to git-tag (the object to be tagged) as this
can often be a specific existing branch name and is not necessarily
the current HEAD.

If the -f option is being used to recreate an existing tag we now
also offer completion support on the existing tag names for the
first argument of git-tag, helping to the user to reselect the
prior tag name that they are trying to replace.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-31 23:47:01 -04:00
Johannes Schindelin
7d37b5bf4e completion: also complete git-log's --left-right and --cherry-pick option
Both --left-right and --cherry-pick are particularly long to type, so
help the user there.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-29 13:19:41 -07:00
David Kågedal
1ff55ff27b git.el: Added colors for dark background
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-29 00:08:32 -07:00
Simon Hausmann
0058a33a8e git-p4: Fix warnings about non-existant refs/remotes/p4/HEAD ref when running git-p4 sync the first time after a git clone.
Don't create the p4/HEAD symbolic ref if p4/master doesn't exist yet.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-24 18:54:37 -07:00
Simon Hausmann
5ca4461728 git-p4: Make 'git-p4 branches' work after an initial clone with git clone from an origin-updated repository.
After a clone with "git clone" of a repository the p4 branches are only in remotes/origin/p4/* and not in remotes/p4/*.
Separate the code for detection and creation out of the P4Sync command class into standalone methods and use them
from the P4Branches command.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-24 18:54:37 -07:00
Shawn O. Pearce
be86f7a0df Teach bash about git-submodule and its subcommands
The git-submodule command is new in 1.5.3 and contains a number
of useful subcommands for working on submodules.  We usually try
to offer the subcommands of a git command in the bash completion,
so here they are for git-submodule.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-23 01:50:49 -04:00
Shawn O. Pearce
217926c08c Teach bash to complete ref arguments to git-describe
I'm often finding that I need to run git-describe on very long
remote tracking branch names, to find out what tagged revision
the remote tracking branch is now at (or not at).  Typing out
the ref names is painful, so bash completion on them is a very
useful feature.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-23 01:42:11 -04:00
Shawn O. Pearce
47e98eecf3 Update bash completion with new 1.5.3 command line options
A number of commands have learned new tricks as part of git 1.5.3.
If these are long options (--foo) we tend to support them in the
bash completion, as it makes the user's task of using the option
slightly easier.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-23 01:39:22 -04:00
Alexandre Julliard
ef08c14993 git.el: Avoid a lisp error when there's no current branch (detached HEAD).
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-22 15:29:08 -07:00
Shawn O. Pearce
8fa0ee3b50 Suggest unsetting core.bare when using new-workdir on a bare repository
If core.bare is set to true in the config file of a repository that
the user is trying to create a working directory from we should
abort and suggest to the user that they remove the option first.

If we leave the core.bare=true setting in the config file then
working tree operations will get confused when they attempt to
execute in the new workdir, as it shares its config file with the
bare repository.  The working tree operations will assume that the
workdir is bare and abort, which is not what the user wants.

If we changed core.bare to be false then working tree operations
will function in the workdir but other operations may fail in the
bare repository, as it claims to not be bare.

If we remove core.bare from the config then Git can fallback on
the legacy guessing behavior.  This allows operations in the bare
repository to work as though it were bare, while operations in the
workdirs to act as though they are not bare.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-22 15:18:13 -07:00
Shawn O. Pearce
e301bfeea1 Fix new-workdir (again) to work on bare repositories
My day-job workflow involves using multiple workdirs attached to a
bunch of bare repositories.  Such repositories are stored inside of
a directory called "foo.git", which means `git rev-parse --git-dir`
will return "." and not ".git".  Under such conditions new-workdir
was getting confused about where the Git repository it was supplied
is actually located.

If we get "." for the result of --git-dir query it means we should
use the user supplied path as-is, and not attempt to perform any
magic on it, as the path is directly to the repository.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-22 15:18:13 -07:00
Mark Levedahl
374a58c9fb git-completion.bash - add support for git-bundle
Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-19 03:38:33 -04:00
Reece H. Dunn
7da660f437 git-p4: Fix the sorting of changelists when cloning a Perforce repository.
When performing a git-p4 clone operation on a Perforce repository,
where the changelists change in order of magnitude (e.g. 100 to 1000),
the set of changes to import from is not sorted properly. This is
because the data in the list is strings not integers. The other place
where this is done already converts the value to an integer, so it is
not affected.

Acked-by: Simon Hausmann <simon@lst.de>
2007-08-13 15:23:14 -07:00
Alexandre Julliard
8fdc39729b git.el: Always set the current directory in the git-diff buffer.
This allows jumping to the correct file with the diff-mode commands.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 12:58:38 -07:00
Alexandre Julliard
09afcd6933 git.el: Add support for interactive diffs.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 12:58:38 -07:00
Junio C Hamano
55d1932bce Merge branch 'cr/tag'
* cr/tag:
  Teach "git stripspace" the --strip-comments option
  Make verify-tag a builtin.
  builtin-tag.c: Fix two memory leaks and minor notation changes.
  launch_editor(): Heed GIT_EDITOR and core.editor settings
  Make git tag a builtin.
2007-08-10 23:17:46 -07:00
Shawn O. Pearce
cabead982b Use the empty tree for base diff in paranoid-update on new branches
We have to load a tree difference for the purpose of testing
file patterns.  But if our branch is being created and there is no
specific base to difference against in the rule our base will be
'0'x40.  This is (usually) not a valid tree-ish object in a Git
repository, so there's nothing to difference against.

Instead of creating the empty tree and running git-diff against
that we just take the output of `ls-tree -r --name-only` and mark
every returned pathname as an add.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-10 01:00:25 -07:00
Shawn O. Pearce
d47eed3272 Teach the update-paranoid to look at file differences
In some applications of the update hook a user may be allowed to
modify a branch, but only if the file level difference is also an
allowed change.  This is the commonly requested feature of allowing
users to modify only certain files.

A new repository.*.allow syntax permits granting the three basic
file level operations:

  A: file is added relative to the other tree
  M: file exists in both trees, but its SHA-1 or mode differs
  D: file is removed relative to the other tree

on a per-branch and path-name basis.  The user must also have a
branch level allow line already granting them access to create,
rewind or update (CRU) that branch before the hook will consult
any file level rules.

In order for a branch change to succeed _all_ files that differ
relative to some base (by default the old value of this branch,
but it can also be any valid tree-ish) must be allowed by file
level allow rules.  A push is rejected if any diff exists that
is not covered by at least one allow rule.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-10 01:00:16 -07:00
Shawn O. Pearce
b767c792fa Teach update-paranoid how to store ACLs organized by groups
In some applications of this paranoid update hook the set of ACL
rules that need to be applied to a user can be large, and the
number of users that those rules must also be applied to can be
more than a handful of individuals.  Rather than repeating the same
rules multiple times (once for each user) we now allow users to be
members of groups, where the group supplies the list of ACL rules.
For various reasons we don't depend on the underlying OS groups
and instead perform our own group handling.

Users can be made a member of one or more groups by setting the
user.memberOf property within the "users/$who.acl" file:

  [user]
    memberOf = developer
	memberOf = administrator

This will cause the hook to also parse the "groups/$groupname.acl"
file for each value of user.memberOf, and merge any allow rules
that match the current repository with the user's own private rules
(if they had any).

Since some rules are basically the same but may have a component
differ based on the individual user, any user.* key may be inserted
into a rule using the "${user.foo}" syntax.  The allow rule does
not match if the user does not define one (and exactly one) value
for the key "foo".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-10 00:59:43 -07:00
Simon Hausmann
ea99c3ae0e git-p4: Fix git-p4 submit to include only changed files in the perforce submit template.
Parse the files section in the "p4 change -o" output and remove lines with file changes in unrelated depot paths.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-08 13:45:04 -07:00
Simon Hausmann
74276ec6f2 git-p4: Fix support for symlinks.
Detect symlinks as file type, set the git file mode accordingly and strip off the trailing newline in the p4 print output.
Make the mode handling a bit more readable at the same time.

Signed-off-by: Simon Hausmann <simon@lst.de>
Acked-by: Brian Swetland <swetland@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-08 01:58:05 -07:00
Junio C Hamano
2ec39edad9 INSTALL: add warning on docbook-xsl 1.72 and 1.73
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-04 01:55:08 -07:00
Junio C Hamano
7fd53fce1c git-completion: add "git stash"
This is a new addition to 1.5.3; let's teach it to the
completion before the final release.

[sp: Added missing git-stash completion configuration]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-04 03:14:28 -04:00
Han-Wen Nienhuys
7fcff9def5 Fix style nit in Python slicing.
Python slices start at 0 by default.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-08-02 09:40:28 +02:00
Han-Wen Nienhuys
a4eba020f9 Sort output of "p4 change" in incremental import before further
processing

P4 change outputs the changes sorted for each directory separately. We
want the global ordering on the changes, hence we sort.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-08-02 09:40:25 +02:00
Alexandre Julliard
274e13e0e9 git.el: Take into account the core.excludesfile config option.
Also don't require .git/info/exclude to exist in order to list unknown
files.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Acked-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-31 23:05:43 -07:00
Alexandre Julliard
61988f1127 git.el: Avoid using ewoc-set-data for compatibility with Emacs 21.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Acked-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-31 23:04:10 -07:00
Carlos Rica
2ae68fcb78 Make verify-tag a builtin.
This replaces "git-verify-tag.sh" with "builtin-verify-tag.c".

Testing relies on the "git tag -v" tests calling this command.

A temporary file is needed when calling to gpg, because git is
already creating detached signatures (gpg option -b) to sign tags
(instead of leaving gpg to add the signature to the file by itself),
and those signatures need to be supplied in a separate file to be
verified by gpg.

The program uses git_mkstemp to create that temporary file needed by
gpg, instead of the previously used "$GIT_DIR/.tmp-vtag", in order to
allow the command to be used in read-only repositories, and also
prevent other instances of git to read or remove the same file.

Signal SIGPIPE is ignored because the program sometimes was
terminated because that signal when writing the input for gpg.

The command now can receive many tag names to be verified.
Documentation is also updated here to reflect this new behaviour.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-26 22:51:27 -07:00
Simon Hausmann
b2d2d16af7 git-p4: Fix p4 user cache population on Windows.
Fall back to USERPROFILE if HOME isn't set.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-25 16:06:54 -07:00
Alexandre Julliard
ceefa44fe2 git.el: Pass an explicit argument to enable smerge-mode.
Without argument the mode is toggled, which would do the wrong thing
if the file was already open.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-25 00:06:38 -07:00
Alexandre Julliard
93c22eeb30 git.el: Support for incremental status updates.
When we know which files have been modified, we can now run diff-index
or ls-files with a file list to refresh only the specified files
instead of the whole project.

This also allows proper refreshing of files upon add/delete/resolve,
instead of making assumptions about the new file state.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-24 03:16:26 -07:00
Carlos Rica
62e09ce998 Make git tag a builtin.
This replaces the script "git-tag.sh" with "builtin-tag.c".

The existing test suite for "git tag" guarantees the compatibility
with the features provided by the script version.

There are some minor changes in the behaviour of "git tag" here:
"git tag -v" now can get more than one tag to verify, like "git tag -d" does,
"git tag" with no arguments prints all tags, more like "git branch" does,
and "git tag -n" also prints all tags with annotations (without needing -l).
Tests and documentation were also updated to reflect these changes.

The program is currently calling the script "git verify-tag" for verify.
This can be changed porting it to C and calling its functions directly
from builtin-tag.c.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-20 01:27:25 -07:00
Junio C Hamano
6fb73e442a Merge branch 'master' of git://people.freedesktop.org/~hausmann/git-p4
* 'master' of git://people.freedesktop.org/~hausmann/git-p4:
  git-p4: Cleanup, used common function for listing imported p4 branches
  git-p4: Fix upstream branch detection for submit/rebase with multiple branches.
  git-p4: Cleanup, make listExistingP4Branches a global function for later use.
  git-p4: input to "p4 files" by stdin instead of arguments
  git-p4: use subprocess in p4CmdList
2007-07-18 17:23:03 -07:00
Simon Hausmann
144ff46b19 git-p4: Cleanup, used common function for listing imported p4 branches
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-18 17:29:38 +02:00
Simon Hausmann
86506fe54c git-p4: Fix upstream branch detection for submit/rebase with multiple branches.
Don't use git name-rev to locate the upstream git-p4 branch for rebase and submit but instead locate the branch by comparing the depot paths.
name-rev may produce results like wrongbranch~12 as it uses the first match.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-07-18 17:29:31 +02:00
Simon Hausmann
062410bb9d git-p4: Cleanup, make listExistingP4Branches a global function for later use.
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-07-18 17:29:05 +02:00
Scott Lamb
788001908c git-p4: input to "p4 files" by stdin instead of arguments
This approach, suggested by Alex Riesen, bypasses the need for xargs-style
argument list handling. The handling in question looks broken in a corner
case with SC_ARG_MAX=4096 and final argument over 96 characters.

Signed-off-by: Scott Lamb <slamb@slamb.org>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-17 08:35:33 +02:00
Scott Lamb
9f90c7335e git-p4: use subprocess in p4CmdList
This allows bidirectional piping - useful for "-x -" to avoid commandline
arguments - and is a step toward bypassing the shell.

Signed-off-by: Scott Lamb <slamb@slamb.org>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-17 08:35:24 +02:00
David Kastrup
99c01de402 contrib/emacs/Makefile: Also install .el files.
Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-15 20:21:51 -07:00
Sean
e3b4968f9c Demote git-p4import to contrib status.
Move git-p4import.py and Documentation/git-p4import.txt into
a contrib/p4import directory.   Add a README there directing
people to contrib/fast-import/git-p4 as a better alternative.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-15 15:23:37 -07:00
Emil Medve
4cb08df553 Use $(RM) in Makefiles instead of 'rm -f'
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-14 23:31:01 -07:00
Junio C Hamano
3f2fd36ebc Merge branch 'master' of git://repo.or.cz/git/fastimport
* 'master' of git://repo.or.cz/git/fastimport:
  Teach fast-import to recursively copy files/directories
  Fix git-p4 on Windows to not use the Posix sysconf function.
  Correct trivial typo in fast-import documentation
2007-07-14 22:57:47 -07:00
Marius Storm-Olsen
48b4c3d5ab Fix git-p4 on Windows to not use the Posix sysconf function.
Add condition for Windows, since it doesn't support the os.sysconf module.
We hardcode the commandline limit to 2K, as that should work on most
Windows platforms.

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-14 22:47:14 -04:00
Junio C Hamano
af6861b144 Add contrib/stats/mailmap.pl script
This script reads the existing commit log and .mailmap file,
and outputs author e-mail addresses that would map to more
than one names (most likely due to difference in the way they
are spelled, but some are due to ancient botched commits).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-14 13:43:49 -07:00
David Kastrup
248c648a0d Add missing functions to contrib/emacs/vc-git.el
This is necessary to make several editing functions work, like
C-u C-x v =

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-12 14:38:15 -07:00
Brian Downing
b492bbd836 Correct shebang line for contrib/stats/packinfo.pl
"/bin/perl"?  What was I thinking?

Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-12 14:18:24 -07:00
Nicolas Pitre
750bd6ac35 script to display a distribution of longest common hash prefixes
This script was originally posted on the git mailing list by
Randal L. Schwartz <merlyn@stonehenge.com>.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-12 14:18:15 -07:00
Brian Downing
73f8936050 Pack information tool
This tool will print vaguely pretty information about a pack.  It
expects the output of "git-verify-pack -v" as input on stdin.

$ git-verify-pack -v | packinfo.pl

See the documentation in the script (contrib/stats/packinfo.pl)
for more information.

Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-11 21:15:23 -07:00
Johannes Schindelin
b4372ef136 Enable "git rerere" by the config variable rerere.enabled
Earlier, "git rerere" was enabled by creating the directory
.git/rr-cache.  That is definitely not in line with most other
features, which are enabled by a config variable.

So, check the config variable "rerere.enabled". If it is set
to "false" explicitely, do not activate rerere, even if
.git/rr-cache exists. This should help when you want to disable
rerere temporarily.

If "rerere.enabled" is not set at all, fall back to detection
of the directory .git/rr-cache.

[jc: with minimum tweaks]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-06 22:39:15 -07:00
Junio C Hamano
5be60078c9 Rewrite "git-frotz" to "git frotz"
This uses the remove-dashes target to replace "git-frotz" to "git frotz".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-02 22:52:14 -07:00
Junio C Hamano
9cc0589ae8 Merge branch 'master' of git://repo.or.cz/git/fastimport
* 'master' of git://repo.or.cz/git/fastimport:
  Teach bash how to complete +refspec on git-push
2007-06-26 22:23:29 -07:00
Simon Hausmann
b658d50325 git-new-workdir: Fix shell warning about operator == used with test.
Use = instead of == with test to test for equality.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-26 18:18:47 -07:00
Shawn O. Pearce
161fea832a Teach bash how to complete +refspec on git-push
Using `git push origin +foo` to forcefully overwrite the remote
branch named foo is a common idiom, especially since + is shorter
than the long option --force and can be specified on a per-branch
basis.

We now complete `git push origin +foo` just like we do the standard
`git push origin foo`.  The leading + on a branch refspec does not
alter the completion.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-24 19:42:16 -04:00
Julian Phillips
09381b458f new-workdir: handle rev-parse --git-dir not always giving full path
rev-parse --git-dir outputs a full path - except for the single case
of when the path would be $(pwd)/.git, in which case it outputs simply
.git.  Check for this special case and handle it.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-24 02:36:56 -07:00
Shawn O. Pearce
610f043bb3 Import branch 'git-p4' of git://repo.or.cz/fast-export
Simon has asked that the git.git project include the git-p4 project
as at least a contrib/fast-import within git.git.  I think it makes
a lot of sense, as git-p4 nicely complements the only other in-tree
fast-import user: import-tars.perl.

git-p4 is offered under the MIT license by its authors.
2007-06-22 19:16:22 -04:00
Shawn O. Pearce
92d7c8e37b Avoid src:dst syntax as default bash completion for git push
Raimund Bauer just discovered that the default bash completion for
a local branch name in a git-push line is not the best choice when
the branch does not exist on the remote system.

In the past we have always completed the local name 'test' as
"test:test", indicating that the destination name is the same as
the local name.  But this fails when "test" does not yet exist on
the remote system, as there is no "test" branch for it to match
the name against.

Fortunately git-push does the right thing when given just the
local branch, as it assumes you want to use the same name in the
destination repository.  So we now offer "test" as the completion
in a git-push line, and let git-push assume that is also the remote
branch name.

We also still support the remote branch completion after the :,
but only if the user manually adds the colon before trying to get
a completion.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-22 18:44:04 -04:00
Simon Hausmann
9ceab36375 Make it possible to specify the HEAD for the internal findUpstreamBranchPoint function.
This isn't used right now in git-p4 but I use it in an external script that loads git-p4 as module.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-22 00:00:34 +02:00
Simon Hausmann
09d89de2e3 Added git-p4 branches command that shows the mapping of perforce depot paths to imported git branches.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-20 23:13:20 +02:00
Simon Hausmann
1a2edf4e8d Warn about conflicting p4 branch mappings and use the first one found.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-17 15:10:24 +02:00
Simon Hausmann
6555b2ccfe Fix the branch mapping detection to be independent from the order of the "p4 branches" output.
Collect "unknown" source branches separately and register them at the end.

Also added a minor speed up to splitFilesIntoBranches by breaking out of the loop through all branches when it's safe.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-17 11:25:59 +02:00
Benjamin Sergeant
da4a660161 git-p4 fails when cloning a p4 depo.
A perforce command with all the files in the repo is generated to get
all the file content.
Here is a patch to break it into multiple successive perforce command
who uses 4K of parameter max, and collect the output for later.

It works, but not for big depos, because the whole perforce depo
content is stored in memory in P4Sync.run(), and it looks like mine is
bigger than 2 Gigs, so I had to kill the process.

[Simon: I added the bit about using SC_ARG_MAX, as suggested by Han-Wen]

Signed-off-by: Benjamin Sergeant <bsergean@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-16 22:06:06 +02:00
Simon Hausmann
3c699645f5 Fix initial multi-branch import.
The list of existing p4 branches in git wasn't initialized.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-16 13:09:21 +02:00
Aneesh Kumar K.V
1be846f6e4 gitview: run blame with -C -C
pass -C -C option to git-blame so that blame browsing
works when the data is copied over from other files.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-13 02:14:26 -07:00
Aneesh Kumar K.V
30a844874d gitview: Fix the blame interface.
The async reading from the pipe was skipping some of the
input lines. Fix the same by making sure that we add the
partial content of the previous read to the newly read
data.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-13 02:14:20 -07:00
Marius Storm-Olsen
cbae7080a7 Only use double quotes on Windows
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
2007-06-12 15:27:52 +02:00
Simon Hausmann
d7e3868cdf Fix git-p4 rebase to detect the correct upstream branch instead of unconditionally
always rebasing on top of remotes/p4/master

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-12 14:34:46 +02:00
Simon Hausmann
27d2d8119b Moved the code from git-p4 submit to figure out the upstream branch point
into a separate helper method.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-12 14:31:59 +02:00
Simon Hausmann
e6b711f00e git-p4 submit: Fix missing quotes around p4 commands to make them work with spaces in filenames
Noticed by Alex Riesen

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 23:41:41 +02:00
Simon Hausmann
81b462a629 Mention remotes/p4/master also in the documentation.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 23:30:23 +02:00
Simon Hausmann
a9d1a27af1 Provide some information for single branch imports where the commits go
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 23:28:03 +02:00
Kevin Green
c3bf3f1301 git-p4: check for existence of repo dir before trying to create
When using git-p4 in this manner:

git-p4 clone //depot/path/project myproject

If "myproject" already exists as a dir, but not a valid git repo, it fails
to create the directory.

Signed-off-by: Kevin Green <Kevin.Green@morganstanley.com>
2007-06-11 23:15:38 +02:00
Simon Hausmann
6581de096e Write out the options tag in the log message of imports only if we actually have
options

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 10:01:58 +02:00
Simon Hausmann
a43ff00c7c Fix support for explicit disabling of syncing with the origin
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 09:59:27 +02:00
Simon Hausmann
86fda6a327 Fix depot-paths encoding for multi-path imports (don't split up //depot/path/foo)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 08:54:45 +02:00
Simon Hausmann
6e5295c4d3 Fix project name guessing
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 08:50:57 +02:00
Simon Hausmann
cae7b732d8 Fix updating/creating remotes/p4/* heads from origin/p4/*
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-10 10:57:40 +02:00
Simon Hausmann
7aded26ce8 Fixed the check to make sure to exclude the HEAD symbolic refs when updating
the remotes/p4 branches from origin.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-10 00:22:30 +02:00
Han-Wen Nienhuys
5265bfcb06 also strip p4/ from local imports.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-06-08 19:31:49 -03:00
Han-Wen Nienhuys
69d8cc8b99 Merge branch 'master' of git://repo.or.cz/fast-export 2007-06-08 18:19:23 -03:00
Han-Wen Nienhuys
1b9a46849a print error message when p4 print fails (eg. due to permission problems)
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-06-08 18:19:16 -03:00
Michael Ellerman
225696af2c gitview: Define __slots__ for Commit
Define __slots__ for the Commit class. This reserves space in each Commit
object for only the defined variables. On my system this reduces heap usage
when viewing a kernel repo by 12% ~= 55868 KB.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-08 02:37:18 -07:00
Michael Ellerman
709b148a90 gitview: Use new-style classes
This changes the Commit class to use new-style class, which has
been available since Python 2.2 (Dec 2001).  This is a necessary
step in order to use __slots__[] declaration, so that we can
reduce the memory footprint in the next patch.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-08 02:37:18 -07:00
Simon Hausmann
df450923a2 Only get the expensive branch mapping from the p4 server when not
syncing with the help of an origin remote (which we instead then use
to get new branches from).

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-08 08:49:22 +02:00
Simon Hausmann
a3fdd57901 Make git-p4 submit detect the correct reference (origin) branch when
working with multi-branch imports.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-07 22:54:32 +02:00
Simon Hausmann
5e100b5cd7 Make clone behave like git clone by default again.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-07 21:52:12 +02:00
Marius Storm-Olsen
c4b33253c2 Exclude the HEAD symbolic ref from the list of known branches
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
2007-06-07 15:28:04 +02:00
Marius Storm-Olsen
db775559c2 Fix single branch import into remotes
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
2007-06-07 15:13:59 +02:00
Marius Storm-Olsen
98ad4faf95 Fix git-p4 clone (defaultDestination)
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
2007-06-07 15:08:33 +02:00
Marius Storm-Olsen
f7baba8b09 Ensure that the commit message is Windows formated (CRLF) before invoking the editor.
(The default editor on Windows (Notepad) doesn't handle Unix line endings)

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-06-07 14:11:15 +02:00
Simon Hausmann
a52d5c7bc0 Fix depot-path determination for git-p4 submit
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 13:10:20 +02:00
Simon Hausmann
b0d10df77a Fix git-p4 submit
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 13:09:14 +02:00
Simon Hausmann
68c4215306 Fix git-p4 rebase
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 12:51:03 +02:00
Simon Hausmann
6509e19cd1 Hack to make the multi-branch import work again with self.depotPaths now that
self.depotPath is gone

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 09:41:53 +02:00
Simon Hausmann
330f53b8d6 Don't attempt to set the initialParent on multi-branch imports (useless).
At some point the code paths should be unified, but for now I need a working
git-p4 :)

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 09:39:51 +02:00
Simon Hausmann
583e170706 Fix common path "calculation" from logs of multiple branches.
Need to use min instead of max for prev/cur to avoid out-of-bounds
string access. Also treat "i" as index of the last match instead of
a length because in case of a complete match of the two strings
i was off by one.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 09:37:13 +02:00
Simon Hausmann
845b42cb6c Fix support for "depot-path" in older git-p4 imports
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 09:19:34 +02:00
Junio C Hamano
a6080a0a44 War on whitespace
This uses "git-apply --whitespace=strip" to fix whitespace errors that have
crept in to our source files over time.  There are a few files that need
to have trailing whitespaces (most notably, test vectors).  The results
still passes the test, and build result in Documentation/ area is unchanged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-07 00:04:01 -07:00
Han-Wen Nienhuys
7530a40ce2 look for 'text' and 'binary' files.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-06-05 20:29:59 -03:00
Han-Wen Nienhuys
b1ce944726 thinko: really ignore deleted files.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-31 14:21:58 -03:00
Han-Wen Nienhuys
b17f88b544 remove debug print
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-31 12:40:24 -03:00
Han-Wen Nienhuys
86dff6b676 Cleanups & import into p4/master for local import
- import into master/local if --import-local is set

- use Die() for exiting

- if --verbose is set, raise Exception()

- use joined strings iso. `list` for progress printing

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-31 12:38:30 -03:00
Han-Wen Nienhuys
d2c6dd30ef use p4CmdList() to get file contents in Python dicts. This is more robust.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-31 11:29:25 -03:00
Han-Wen Nienhuys
f2eda79f69 only run p4 print if necessary
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 18:50:41 -03:00
Han-Wen Nienhuys
982bb8a303 don't p4 print deleted files.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 17:33:18 -03:00
Han-Wen Nienhuys
96e07dd23c read files before creating the commit.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 16:57:59 -03:00
Han-Wen Nienhuys
a3287be5bc thinko.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 16:38:32 -03:00
Han-Wen Nienhuys
183b8ef89b store p4 user cache in home directory.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 16:35:32 -03:00
Han-Wen Nienhuys
9320da8dd4 Thinko, fix buglet.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 16:22:57 -03:00
Han-Wen Nienhuys
6a49f8e2e0 Read p4 files in one batch.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 16:21:46 -03:00
Han-Wen Nienhuys
b86f73782e remove global .gitdir
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 13:58:19 -03:00
Han-Wen Nienhuys
5e926eed9f Merge origin. 2007-05-30 13:46:25 -03:00
Han-Wen Nienhuys
bb6e09b27a Diverse cleanups
- print commands with \n

- extractDepotPathsAndChangeFromGitLog -> extractSettings, returning
dict.

- store keepRepoPath in [git-p4: ] line

- create a main() function, so git-p4 can be pychecked

- use --destination for clone destination. This simplifies logic
for --keep-path

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 13:44:15 -03:00
Shawn O. Pearce
2e4aef5893 Allow contrib new-workdir to link into bare repositories
On one particular system I like to keep a cluster of bare Git
repositories and spawn new-workdirs off of them.  Since the bare
repositories don't have working directories associated with them
they don't have a .git/ subdirectory that hosts the repository we
are linking to.

Using a bare repository as the backing repository for a workdir
created by this script does require that the user delete core.bare
from the repository's configuration file, so that Git auto-senses
the bareness of a repository based on pathname information, and
not based on the config file.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-29 00:27:21 -07:00
Simon Hausmann
cfeb59be25 Fix typo in listExistingP4Branches that broke sync.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-28 19:24:57 +02:00
Simon Hausmann
9226c03c32 In *_pipe print the command that failed if it fails.
Fixed old calls to mypopen.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-28 19:23:19 +02:00
Han-Wen Nienhuys
6326aa5866 Extract multiple paths concurrently.
This enables importing just the interesting bits of large
repositories.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 12:50:04 -03:00
Han-Wen Nienhuys
4addad2291 add --verbose to all commands.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:45:26 -03:00
Han-Wen Nienhuys
b25b20656d use strip() iso. slicing for removing \n
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:20:50 -03:00
Han-Wen Nienhuys
b76f0565bf use string.strip() iso. slicing.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:19:10 -03:00
Han-Wen Nienhuys
8b41a97f8a clone and sync --keep-path to keep perforce path to module.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:18:31 -03:00
Han-Wen Nienhuys
6754a299d8 minor cleanups
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:17:27 -03:00
Han-Wen Nienhuys
bce4c5fc0b cleanup
- use re.sub() iso. if for stripping ...
- spacing nits

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:15:43 -03:00
Han-Wen Nienhuys
b016d39756 Robustness fixes for pipes
- add read_pipe(), read_pipe_lines(), write_pipe(), which
check pipe.close()

- use throughout

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:15:29 -03:00
Simon Hausmann
c8cbbee980 Fix my email address, this isn't really KDE related :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-28 14:43:25 +02:00
Han-Wen Nienhuys
7cb5cbefd2 rename apply() to applyCommit(); apply is a python builtin
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 14:29:11 +02:00
Han-Wen Nienhuys
cebdf5af31 reformatting: break long lines.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 14:28:58 +02:00
Han-Wen Nienhuys
ce6f33c835 Cleanups
- don't use dir (python builtin)
- use re for munging depotPath into destination

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 14:22:53 +02:00
Simon Hausmann
a3c55c09ec Fix creation of refs/remotes/p4/HEAD symbolic ref
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-27 15:48:01 +02:00
Simon Hausmann
cb4f1280dd Added git-p4 submit --trust-me-like-a-fool for the adventurous users :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-25 22:34:30 +02:00
Simon Hausmann
877db584aa Forgot to remove this TODO item when I made --with-origin the default :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-25 19:43:38 +02:00
Simon Hausmann
d414c74afd Shortcut the case where we have no origin branch
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-25 11:36:42 +02:00
Simon Hausmann
01265103fe Make --with-origin the default for syncing.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-25 10:36:10 +02:00
Simon Hausmann
417a7a6fc8 Make --with-origin also work without origin :)
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-25 10:28:46 +02:00
Simon Hausmann
4280e53333 Make git-p4 work with packed refs (don't use os.path.exists to check for the
existance of a ref)

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-25 08:49:18 +02:00
Simon Hausmann
65c5f3e3f2 Avoid creating non-p4 branches in remotes/p4 off of remotes/origin
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-25 08:44:41 +02:00
Simon Hausmann
10f880f8d4 Oops, fix --with-origin to /really/ also call git fetch :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-24 22:28:28 +02:00
Simon Hausmann
abcd790fe9 Added support for --with-origin with multi-branch imports
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-24 22:25:36 +02:00
Simon Hausmann
2cc58fd99a Forgot to remove this return statement from debugging
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-24 22:10:40 +02:00
Simon Hausmann
d1874ed33b Fix creating the remotes/p4 branches based on origin/* for the multi-branch import
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-24 21:23:04 +02:00
Marius Storm-Olsen
c1f9197f37 Replace \r\n with \n when importing from p4 on Windows
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-05-24 14:17:29 +02:00
Shawn O. Pearce
12977705b3 Update bash completion for git-config options
A few new configuration options grew out of the woodwork during the
1.5.2 series.  Most of these are pretty easy to support a completion
of, so we do so.

I wanted to also add completion support for the <driver> part of
merge.<driver>.name but to do that we have to look at all of the
.gitattributes files and guess what the unique set of <driver>
strings would be.  Since this appears to be non-trivial I'm punting
on it at this time.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-24 02:07:45 -04:00
Shawn O. Pearce
8f87fae645 Teach bash completion about recent log long options
(Somewhat) recently git-log learned about --reverse (to show commits
in the opposite order) and a looong time ago I think it learned
about --raw (to show the raw diff, rather than a unified diff).
These are both useful options, so we should make them easy for the
user to complete.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-24 01:51:30 -04:00
Shawn O. Pearce
fb72759b7d Teach bash completion about 'git remote update'
Recently the git-remote command grew an update subcommand, which
can be used to execute git-fetch across multiple repositories
in a single step.  These can be configured with the 'remotes.*'
configuration options, so we can offer completion for any name that
matches and appears to be useful to git-remote update.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-24 01:46:49 -04:00
Shawn O. Pearce
c70680ce7c Update bash completion header documentation
1) Added a note about supporting the long options for most commands,
    as we have been doing so for quite some time.

 2) Include a notice that these routines are covered by the GPL,
    as that may not be obvious, even though they are distributed
    as part of the core Git distribution.

 3) Added a short section on how to send patches to the routines,
    and to whom they should get sent to.  Currently that is me,
    as I am the active maintainer.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-24 01:36:46 -04:00
Shawn O. Pearce
bfbd131f52 Remove a duplicate --not option in bash completion
This was just me being silly; I put the --not option into the
completion list twice.  There's no duplicates shown in the shell
as the shell removes them before showing them to the user.  But we
really don't need the duplicates in the source script either.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-24 01:26:58 -04:00
Shawn O. Pearce
1fd6bec9bc Teach bash completion about git-shortlog
We've had completion for git-log for quite some time, but just
today I noticed we don't have it for the new builtin shortlog
that runs git-log internally.  This is indeed a handy thing to
have completion for, especially when your branch names are of
the Very-Very-Long-and-Hard/To-Type/Variety/That-Some-Use.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-24 01:25:34 -04:00
Shawn O. Pearce
5cfb4fe525 Hide the plumbing diff-{files,index,tree} from bash completion
The diff-* programs are meant to be plumbing for the diff frontend;
most end users aren't invoking these commands directly.  Consequently
we should avoid showing them as possible completions.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-24 01:10:15 -04:00
Simon Hausmann
ebd8116870 Load the user map from p4 only once at run-time.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-24 00:24:52 +02:00
Simon Hausmann
b3fd1b2808 Fix multi-branch import with --silent.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 23:53:14 +02:00
Simon Hausmann
ad192f2888 Fix p4 execution in git-p4 rollback.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 23:44:19 +02:00
Simon Hausmann
66a2f52395 Catch p4 errors in rollback early enough (before deleting refs!)
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 23:40:48 +02:00
Simon Hausmann
ac3e0d79ee Oops, fill the /list/ correct with the p4 exit code.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 23:32:32 +02:00
Simon Hausmann
a6d5da36af Don't make len(p4Cmd("p4 changes -m 1 //foo/...")) == 0 succeed when the p4 command itself failed.
When the p4 command failed write out the exit code in the returned dict.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 23:29:01 +02:00
Simon Hausmann
0c66a78393 Make rollback work with locally imported branches
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 20:07:57 +02:00
Simon Hausmann
65d2ade95e Avoid calling git symbolic-ref refs/heads/p4//HEAD (double slash)
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 16:41:46 +02:00
Simon Hausmann
a396b29267 Doc updates
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-23 00:33:34 +02:00
Simon Hausmann
57284050a8 Use refs/heads/* instead of refs/heads/p4/* for local imports
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 00:15:50 +02:00
Simon Hausmann
01a9c9c5a8 Added support for --max-changes=<count> to ease import debugging
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 00:07:35 +02:00
Simon Hausmann
a028a98e9a Added support for importing multiple branches into refs/heads instead of just refs/remotes
using --import-local. Needs some further microfix but seems to work otherwise.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 00:03:08 +02:00
Simon Hausmann
52102d4784 Fixes for rollback, delete branches that did not exist at the specified p4 change
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 23:44:24 +02:00
Simon Hausmann
af8da89cb7 Fix branch detection in multi-branch imports
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 23:25:51 +02:00
Simon Hausmann
5834684d51 Added a rollback command for debugging. It sets back the heads of the p4 branches to the specified p4 change number or earlier.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 22:57:06 +02:00
Simon Hausmann
7944f1425c Make git-p4 submit --direct safer by also creating a git commit
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 11:04:26 +02:00
Simon Hausmann
cbf5efa61a Detect with git-p4 submit --direct when there are no changes in the working directory
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 10:08:11 +02:00
Simon Hausmann
faf1bd2026 Fix git symbolic-ref warning on initial clone
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 10:05:30 +02:00
Simon Hausmann
dc52403696 Fix error detection with git-p4 submit when the requested depot path is not in the client view.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 09:34:56 +02:00
Simon Hausmann
33be3e6550 Fix conversion from old style heads/p4 to remotes/p4/master
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-21 08:44:16 +02:00
Jonas Fonseca
56d99c67d1 Update bash completion to ignore some more plumbing commands
[sp: Modified Jonas' original patch to keep checkout-index
 as a a valid completion.]

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-21 02:09:26 -04:00
Simon Hausmann
341dc1c179 Improved output for multi branch imports and noted another little todo item
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 00:39:16 +02:00
Simon Hausmann
b1561ee256 Another (potentially life-saving) idea for submit --direct
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 23:52:51 +02:00
Simon Hausmann
24f7b53fdd Had an idea for debugging, record it :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 23:42:22 +02:00
Simon Hausmann
8a5fc95b43 Specifying --detect-branches is now only needed for the initial clone/sync.
Afterwards it's turned on implicitly if more p4 branches than remotes/p4/master
are found.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-20 23:39:40 +02:00
Simon Hausmann
c1b296b9f1 Added support for git-p4 submit --direct (experimental)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 16:55:05 +02:00
Simon Hausmann
47a130b7bf Use git format-patch and git apply --apply when extracting patches from git and
applying them to a Perforce checkout. This should make it possible to apply git
commits with binary files that cannot be handled by path.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 16:33:21 +02:00
Simon Hausmann
64ffb06a9c Oops, not only /set/ gitdir on clone, also set it /correctly/ :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 15:24:01 +02:00
Simon Hausmann
59fa417109 Fix gitdir not being set when cloning. Needed for writing the p4 users cache.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 15:15:34 +02:00
Simon Hausmann
b607e71efd Cache the output of "p4 users" for faster syncs on high latency links.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 10:55:54 +02:00
Simon Hausmann
9bda3a8556 Removed unused variable, more cleanups
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-19 12:05:40 +02:00
Simon Hausmann
71b112d4a4 More cleanups and speedups for labels and branches
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-19 11:54:11 +02:00
Simon Hausmann
d5904674d1 Cleanup/speed up the branch<> file split and removed change range limitation that I added
for debugging (oops).

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-19 11:07:32 +02:00
Simon Hausmann
29bdbac1cd More work on the incremental importing of multiple branches.
Improved error detection by checking the exit code of git-fast-import.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-19 10:23:12 +02:00
Simon Hausmann
8f9b2e082b Give branches a nice project prefix and don't bail out on clone if we failed
to detect the master branch.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-18 22:13:26 +02:00
Simon Hausmann
4b97ffb1e4 Started rewriting the branch detection, based on "p4 branches" and "p4 branch -o foo".
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-18 21:45:23 +02:00
Simon Hausmann
66c6a9b559 Removed unused cache variables.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-18 20:39:38 +02:00
Simon Hausmann
05094f987c Fix branch setup after initial clone.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-18 20:32:35 +02:00
Simon Hausmann
71bd9bacec Removed todo item that is implemented :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 22:22:26 +02:00
Simon Hausmann
ef48f9093c Added support for git-p4 sync/rebase --with-origin. See git-p4.txt for details :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 22:17:49 +02:00
Simon Hausmann
48df6fd850 Bite the bullet and automatically convert old style refs/heads/p4 repositories
to the new style refs/remotes/p4 branching.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 21:18:53 +02:00
Simon Hausmann
c6d44cb1a1 Changed the default p4 import branch to be refs/remotes/p4/{HEAD,master}
instead of refs/heads/p4.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 20:57:05 +02:00
Simon Hausmann
8ead4fda3f Create the origin based import branch using git update-ref instead of git branch
so that it's possible to have the import branch in refs/remotes.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 20:26:58 +02:00
Simon Hausmann
1c9d393d30 Removed ancient and unused code to find the last imported revision from previous imports
to use for the current import by looking at the p4 tags. The current approach of using
the log message works better.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 20:15:47 +02:00
Simon Hausmann
8a2820def4 Removed cleantags command. It doesn't have any meaning anymore.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 19:44:50 +02:00
Simon Hausmann
463e8af655 Clean up code duplication for revision parsing and fix previous commit to not
import into remotes/p4 (yet!).

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 09:13:54 +02:00
Simon Hausmann
f9162f6a4c Always pass a sha1 for the initial parent so that git-fast-import doesn't think
it's creating a new branch from itself. It's a sensible error in general but
in the case of incremental imports we have to apply force :)

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 09:09:05 +02:00
Simon Hausmann
5c4153e488 Fixing syncing (gitdir discovery / cd) for bare repositories
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 07:42:38 +02:00
Junio C Hamano
fdcb769916 Merge branch 'maint'
* maint:
  format-patch: add MIME-Version header when we add content-type.
  Fixed link in user-manual
  import-tars: Use the "Link indicator" to identify directories
  git name-rev writes beyond the end of malloc() with large generations
  Documentation/branch: fix small typo in -D example
2007-05-16 12:43:05 -07:00
Johannes Schindelin
df8cfac815 import-tars: Use the "Link indicator" to identify directories
Earlier, we used the mode to determine if a name was associated with
a directory. This fails, since some tar programs do not set the mode
correctly. However, the link indicator _has_ to be set correctly.

Noticed by Chris Riddoch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-16 14:54:22 -04:00
Simon Hausmann
ca0affe7bb A little todo note before I forget it :), based on a suggestion from Lars.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-16 13:15:34 +02:00
Simon Hausmann
dc1a93b6dc Fix calling git-p4 rebase from within a subdirectory (git rebase wants to be in toplevel)
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-16 12:12:39 +02:00
Simon Hausmann
c3c4624451 Give a better hint if git-p4 submit fails
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-16 09:43:13 +02:00
Simon Hausmann
d336c15835 Added the possibility of skipping patches during git-p4 submit
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-16 09:41:46 +02:00
Simon Hausmann
81f2373f89 Make git-p4 work with bare repositories.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-15 23:06:43 +02:00
Simon Hausmann
cd6cc0d318 Fix git-p4 clone //depot/project (head import)
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-15 16:15:26 +02:00
Marius Storm-Olsen
95962f318e Make the command call silent
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-05-15 16:07:41 +02:00
Simon Hausmann
42890f6291 Converted to unix newlines
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-15 16:07:02 +02:00
Simon Hausmann
25df95cce4 Make submitting work on Windows.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-05-15 15:15:07 +02:00
Simon Hausmann
caace11112 Make sure all popen calls use binary mode (for Windows) and
also make gitBranchExists work on Windows.

Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-05-15 15:15:07 +02:00
Simon Hausmann
ac1fde55a7 Added a little .bat wrapper from Marius
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-05-15 14:44:32 +02:00
Simon Hausmann
0848358055 Use the subprocess module instead of popen2 to make it work on Windows.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-05-15 14:27:56 +02:00
Junio C Hamano
ffcc952b33 Merge branch 'maint'
* maint:
  Fix documentation of tag in git-fast-import.txt
  Properly handle '0' filenames in import-tars
2007-05-10 14:48:04 -07:00
Shawn O. Pearce
d966e6aa66 Properly handle '0' filenames in import-tars
Randal L. Schwartz pointed out multiple times that we should be
testing the length of the name string here, not if it is "true".
The problem is the string '0' is actually false in Perl when we
try to evaluate it in this context, as '0' is 0 numerically and
the number 0 is treated as a false value.  This would cause us
to break out of the import loop early if anyone had a file or
directory named "0".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-07 21:13:40 -04:00
Simon Hausmann
a844b7406f Document some implementation details, for the curious... :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-07 20:14:17 +02:00
Shawn O. Pearce
db81e67a7d Merge branch 'gfi-maint' into gfi-master
* gfi-maint:
  Teach import-tars about GNU tar's @LongLink extension.
2007-05-02 13:24:10 -04:00
Johannes Schindelin
775477aa1d Teach import-tars about GNU tar's @LongLink extension.
This extension allows GNU tar to process file names in excess of the 100
characters defined by the original tar standard. It does this by faking a
file, named '././@LongLink' containing the true file name, and then adding
the file with a truncated name. The idea is that tar without this
extension will write out a file with the long file name, and write the
contents into a file with truncated name.

Unfortunately, GNU tar does a lousy job at times. When truncating results
in a _directory_ name, it will happily use _that_ as a truncated name for
the file.

An example where this actually happens is gcc-4.1.2, where the full path
of the file WeThrowThisExceptionHelper.java truncates _exactly_ before the
basename. So, we have to support that ad-hoc extension.

This bug was noticed by Chris Riddoch on IRC.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-02 13:22:34 -04:00
Simon Hausmann
2835925139 Cleanup, removed the old tagging code
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-01 23:26:19 +02:00
Simon Hausmann
8f8725314d cleanup, renamed self.globalPrefix to self.depotPath
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-01 23:23:00 +02:00
Simon Hausmann
1c094184da Micro cleanup
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-01 23:15:48 +02:00
Simon Hausmann
ff5dba20e3 Doc cleanups.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-01 18:28:38 +02:00
Junio C Hamano
39231b1c32 Merge branch 'maint'
* maint:
  http.c: Fix problem with repeated calls of http_init
  Add missing reference to GIT_COMMITTER_DATE in git-commit-tree documentation
  Fix import-tars fix.
  Update .mailmap with "Michael"
  Do not barf on too long action description
  Catch empty pathnames in trees during fsck
  Don't allow empty pathnames in fast-import
  import-tars: be nice to wrong directory modes
  git-svn: Added 'find-rev' command
  git shortlog documentation: add long options and fix a typo
2007-04-29 01:52:43 -07:00
Junio C Hamano
d0c32b6339 Fix import-tars fix.
This heeds advice from our resident Perl expert to make sure
the script is not confused with a string that ends with /\n

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-29 01:34:59 -07:00
Johannes Schindelin
87859f3443 import-tars: be nice to wrong directory modes
Some tars seem to have modes 0755 for directories, not 01000755. Do
not generate an empty object for them, but ignore them.

Noticed by riddochc on IRC.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-04-28 20:01:36 -04:00
Andy Parkins
c855195cd0 post-receive-email example hook: sed command for getting description was wrong
The sed command that extracted the first line of the project description
didn't include the -n switch and hence the project name was being
printed twice.  This was ruining the email header generation because it
was assumed that the description was only one line and was included in
the subject.  This turned the subject into a two line item and
prematurely finished the header.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-26 20:59:55 -07:00
Andy Parkins
024e5b31af post-receive-email example hook: detect rewind-only updates and output sensible message
Sometimes a non-fast-forward update doesn't add new commits, it merely
removes old commits.  This patch adds support for detecting that and
outputting a more correct message.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-26 20:59:49 -07:00
Andy Parkins
8e404f82ab post-receive-email example hook: fastforward should have been fast_forward
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-26 20:58:04 -07:00
Junio C Hamano
61397d4b8d Merge branch 'master' of git://repo.or.cz/git/fastimport
* 'master' of git://repo.or.cz/git/fastimport:
  fast-import: size_t vs ssize_t
  fix importing of subversion tars
  Don't repack existing objects in fast-import
2007-04-24 22:02:38 -07:00
Uwe Kleine-König
46f6178a3f fix importing of subversion tars
add a / between the prefix and name fields of the tar archive if prefix
is non-empty.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-04-24 12:14:40 -04:00
Josh Triplett
2122591b3b Add clean.requireForce option, and add -f option to git-clean to override it
Add a new configuration option clean.requireForce.  If set, git-clean will
refuse to run, unless forced with the new -f option, or not acting due to -n.

Signed-off-by: Josh Triplett <josh@freedesktop.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-23 22:13:50 -07:00
Aneesh Kumar K.V
2c9750cc8b gitview: annotation support
List files modifed as a part of the commit in the diff window
Support annotation of the file listed in the diff window
Support history browsing in the annotation window.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-20 01:46:42 -07:00
Alexandre Julliard
413689d36f git.el: Add a commit description to the reflog.
Add a description of the commit to the reflog using the first line of
the log message, the same way the git-commit script does it.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-19 23:27:51 -07:00
Shawn O. Pearce
9398e5aa16 Contribute a fairly paranoid update hook
I'm using a variant of this update hook in a corporate environment
where we perform some validations of the commits and tags that
are being pushed.  The model is a "central repository" type setup,
where users are given access to push to specific branches within
the shared central repository.  In this particular installation we
run a specially patched git-receive-pack in setuid mode via SSH,
allowing all writes into the repository as the repository owner,
but only if this hook blesses it.

One of the major checks we perform with this hook is that the
'committer' line of a commit, or the 'tagger' line of a new annotated
tag actually correlates to the UNIX user who is performing the push.
Users can falsify these lines on their local repositories, but
the central repository that management trusts will reject all such
forgery attempts.  Of course 'author' lines are still allowed to
be any value, as sometimes changes do come from other individuals.

Another nice feature of this hook is the access control lists for
all repositories on the system can also be stored and tracked in
a supporting Git repository, which can also be access controlled
by itself.  This allows full auditing of who-had-what-when-and-why,
thanks to git-blame's data mining capabilities.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-19 23:27:09 -07:00
Simon Hausmann
51a2640afd Handle patch errors in git-p4 submit better.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-15 09:59:56 +02:00
Simon Hausmann
90865adc01 A new attempt at fixing the child-fast-import-process-not-finished race condition
in the clone command

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-15 09:34:15 +02:00
Simon Hausmann
5e80dd4d7e Slightly improved formatting of the raw_input questions.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-14 16:09:43 +02:00
Simon Hausmann
8b72ca0f76 Removed the old patch apply code from git-p4 submit.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-14 16:05:54 +02:00
Simon Hausmann
f291b4e3d4 Fix the timezone formatting. Now qgit also displays (parses) it correctly.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-14 11:21:50 +02:00
Simon Hausmann
fd4ca86a0b Print an error message of some sort if git fast-import fails.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-13 22:21:10 +02:00
Simon Hausmann
80b5910fac Allow for convenient rebasing after git-p4 submit
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-09 12:43:40 +02:00
Simon Hausmann
7243b350b3 Added a simple example of usage to the "documentation" :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 10:21:56 +02:00
Simon Hausmann
10c3211b81 fix variable usage (oops)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 10:15:47 +02:00
Simon Hausmann
c45b1cfe1e Fix file determination for #head imports
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 10:13:32 +02:00
Simon Hausmann
f9a3a4f796 Added git-p4 clone convenience command
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 10:08:26 +02:00
Simon Hausmann
68ed351ab5 Honor --silent for labels
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 09:00:55 +02:00
Simon Hausmann
cb53e1f8e9 Turn off potentially slow label detection by default
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 00:12:02 +02:00
Simon Hausmann
1f52af6c73 Provide a tree summary after git-p4 rebase
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 00:07:02 +02:00
Simon Hausmann
01ce1fe967 Added git-p4 rebase convenience
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-07 23:46:50 +02:00
Junio C Hamano
77e6f5bc10 Merge branch 'maint'
* maint:
  Fix lseek(2) calls with args 2 and 3 swapped
  Honor -p<n> when applying git diffs
  Fix dependency of common-cmds.h
  Fix renaming branch without config file
  DESTDIR support for git/contrib/emacs
  gitweb: Fix bug in "blobdiff" view for split (e.g. file to symlink) patches
  Document --left-right option to rev-list.
  Revert "builtin-archive: use RUN_SETUP"
  rename contrib/hooks/post-receieve-email to contrib/hooks/post-receive-email.
  rerere: make sorting really stable.
  Fix t4200-rerere for white-space from "wc -l"
2007-04-05 16:34:51 -07:00
Ville Skyttä
1e31fbe24f DESTDIR support for git/contrib/emacs
make install DESTDIR=... support for git/contrib/emacs

Signed-off-by: Ville Skyttä <scop@xemacs.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-05 14:14:55 -07:00
Gerrit Pape
5850cb645d rename contrib/hooks/post-receieve-email to contrib/hooks/post-receive-email.
$ git grep post-receieve-email
 $ git grep post-receive-email
 templates/hooks--post-receive:#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
 $

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-04 22:17:59 -07:00
Simon Hausmann
711544b00c Clean up python class names.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-04-01 15:40:46 +02:00
Simon Hausmann
2a9489c024 Fix "compilation" :)
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-04-01 13:39:39 +02:00
Xavier Maillard
3cc5ca3923 git-blame.el: pick a set of random colors for each git-blame turn
I thought it would be cool to have different set of colors for each
git-blame-mode. Function `git-blame-new-commit' does this for us
picking when possible, a random colors based on the set we build on
startup. When it fails, `git-blame-ancient-color' will be used. We
also take care not to use the same color more than once (thank you
David Kågedal, really).

* Prevent (future possible) namespace clash by renaming `color-scale'
into `git-blame-color-scale'. Definition has been changed to be more
in the "lisp" way (thanks for help to #emacs). Also added a small
description of what it does.

* Added docstrings at some point and instructed defvar when a variable
was candidate to customisation by users.

* Added missing defvar to silent byte-compilers (git-blame-file,
git-blame-current)

* Do not require 'cl at startup

* Added more informations on compatibility

Signed-off-by: Xavier Maillard <zedek@gnu.org>
Acked-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-31 23:58:10 -07:00
Xavier Maillard
02f0559eba git-blame.el: separate git-blame-mode to ease maintenance
git-blame-mode has been splitted into git-blame-mode-on and
git-blame-mode-off; it now conditionnaly calls one of them depending
of how we call it. Code is now easier to maintain and to understand.

Fixed `git-reblame' function: interactive form was at the wrong
place.

String displayed on the mode line is now configurable through
`git-blame-mode-line-string` (default to " blame").

Signed-off-by: Xavier Maillard <zedek@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-31 23:58:10 -07:00
Julian Phillips
4f01748d51 contrib/workdir: add a simple script to create a working directory
Add a simple script to create a working directory that uses symlinks
to point at an exisiting repository.  This allows having different
branches in different working directories but all from the same
repository.

Based on a description from Junio of how he creates multiple working
directories[1].  With the following caveat:

"This risks confusion for an uninitiated if you update a ref that
is checked out in another working tree, but modulo that caveat
it works reasonably well."

[1] http://article.gmane.org/gmane.comp.version-control.git/41513/

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-31 01:26:28 -07:00
Andy Parkins
4557e0de5b Reimplement emailing part of hooks--update in contrib/hooks/post-receive-email
The update hook is no longer the correct place to generate emails; there
is now the hooks/post-receive script which is run automatically after a
ref has been updated.

This patch is to make use of that new location, and to address some
faults in the old update hook.

The primary problem in the conversion was that in the update hook, the
ref has not actually been changed, but is about to be.  In the
post-receive hook the ref has already been updated.  That meant that
where we previously had lines like:

 git rev-list --not --all

would now give the wrong list because "--all" in the post-receive hook
includes the ref that we are making the email for.  This made it more
difficult to show only the new revisions added by this update.

The solution is not pretty; however it does work and doesn't need any
changes to git-rev-list itself.  It also fixes (more accurately: reduces
the likelihood of) a nasty race when another update occurs while this
script is running.  The solution, in short, looks like this (see the
source code for a longer explanation)

 git rev-parse --not --all | grep -v $(git rev-parse $refname) |
 git rev-list --pretty --stdin $oldrev..$newrev

This uses git-rev-parse followed by grep to filter out the revision of
the ref in question before it gets to rev-list and inhibits the output
of itself.  By using $(git rev-parse $revname) rather than $newrev as the
filter, it also takes care of the situation where another update to the
same ref has been made since $refname was $newrev.

The second problem that is addressed is that of tags inhibiting the
correct output of an update email.  Consider this, with somebranch and
sometag pointing at the same revision:

 git push origin somebranch
 git push origin sometag

That would work fine; the push of the branch would generate an email
containing all the new commits introduced by the update, then the push
of the tag would generate the shortlog formatted tag email.  Now
consider:

 git push origin sometag
 git push origin somebranch

When some branch comes to run its "--not --all" line, it will find
sometag, and filter those commits from the email - leaving nothing.
That meant that those commits would not show (in full) on any email.
The fix is to not use "--all", and instead use "--branches" in the
git-rev-parse command.

Other changes
 * Lose the monstrous one-giant-script layout and put things in easy to
   digest functions.  This makes it much easier to find the place you
   need to change if you wanted to customise the output.  I've also
   tried to write more verbose comments for the same reason.  The hook
   script is big, mainly because of all the different cases that it has
   to handle, so being easy to navigate is important.
 * All uses of "git-command" changed to "git command", to cope better
   if a user decided not to install all the hard links to git;
 * Cleaned up some of the English in the email
 * The fact that the receive hook makes the ref available also allows me
   to use Shawn Pearce's fantastic suggestion that an annotated tag can
   be parsed with git-for-each-ref.  This removes the potentially
   non-portable use of "<<<" heredocs and the nasty messing around with
   "date" to convert numbers of seconds UTC to a real date
 * Deletions are now caught and notified (briefly)
 * To help with debugging, I've retained the command line mode from the
   update hook; but made it so that the output is not emailed, it's just
   printed to the screen.  This could then be redirected if the user
   wanted
 * Removed the "Hello" from the beginning of the email - it's just
   noise, and no one seriously has their day made happier by "friendly"
   programs
 * The fact that it doesn't rely on repository state as an indicator any
   more means that it's far more stable in its output; hopefully the
   same arguments will always generate the same email - even if the
   repository changes in the future.  This means you can easily recreate
   an email should you want to.
 * Included Jim Meyering's envelope sender option for the sendmail call
 * The hook is now so big that it was inappropriate to copy it
   to every repository by keeping it in the templates directory.
   Instead, I've put a comment saying to look in contrib/hooks, and
   given an example of calling the script from that template hook.  The
   advantage of calling the script residing at some fixed location is
   that if a future package of git included a bug fixed version of the
   script, that would be picked up automatically, and the user would not
   have to notice and manually copy the new hook to every repository
   that uses it.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-31 01:21:18 -07:00
Simon Hausmann
c9b50e6307 Fix the docs for git-p4 submit and turn git-p4 submit --master=foo into
simply git-p4 submit mytopicbranch.

Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-29 19:15:24 +02:00
Simon Hausmann
a46668faf7 Fix variable usage in tag import
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-28 17:05:38 +02:00
Alexandre Julliard
b704e589f4 git.el: Display some information about the HEAD commit.
Use git-log --pretty=oneline to print a short description of the
current HEAD (and merge heads if any) in the buffer header.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-27 12:52:41 -07:00
Simon Hausmann
1f4ba1cbfc Added support for mapping p4 labels to git tags
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-26 22:34:34 +02:00
Simon Hausmann
8910ac0e88 git-p4 debug doesn't need a git repository
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-26 08:18:55 +02:00
Simon Hausmann
e20a9e530a Don't try to parse any options with git-p4 debug but pass it straight on to p4
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-26 00:13:51 +02:00
Simon Hausmann
9863f4055e Prefer git command over git-command.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-24 16:35:05 +01:00
Simon Hausmann
274917a3d6 Minor cosmetic fixlet for the git-p4 submit sync question.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-24 09:18:20 +01:00
Simon Hausmann
cb2c9db507 Different versions of p4 have different output for the where command ;(
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-24 09:15:11 +01:00
Simon Hausmann
967f72e21b Use the new incremental import style by default
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-03-23 09:30:41 +01:00
Simon Hausmann
9512497bcf Make it possible to run git-p4 submit from within the git repository
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-23 09:16:07 +01:00
Simon Hausmann
179caebff4 Brand new smart incremental import that doesn't need tags or git repo-config :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 22:17:42 +01:00
Simon Hausmann
569d1bd409 Set the default branch in run, not in the constructor
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 21:34:16 +01:00
Simon Hausmann
8136a6399c Helper function to check the existance of a revision
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 21:27:14 +01:00
Simon Hausmann
6ae8de88f5 Added some helper function(s) to parse the depot path and change number from the log message
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 21:10:25 +01:00
Simon Hausmann
f5816a5522 Changed the default branch for imports from "master" to "p4"
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 20:36:28 +01:00
Simon Hausmann
a559b289bd Changed the format of the imported log message slightly, so that it's easier to parse again.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 20:27:41 +01:00
Simon Hausmann
e7f0d0d9b9 Removed the .py extension from git-p4 as it's annoying to type every time.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-22 09:15:32 +01:00
Simon Hausmann
53150250b1 Don't show the submit template and the diff first in less but show it in $editor right away
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-21 21:04:12 +01:00
Simon Hausmann
2061865005 Make it possible to invoke git-p4 from within subdirectories of a git working tree.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-21 13:05:30 +01:00
Simon Hausmann
1932a6ac7c Made --apply-as-patch the default for git-p4 submit as it's significantly faster.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-21 11:01:18 +01:00
Simon Hausmann
5d0b6042d4 Fix support for deletions in git-p4 submit when using --apply-as-patch by filtering out deletions in the diff-tree output.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-21 10:57:54 +01:00
Simon Hausmann
04219c04b7 Added experimental but super-fast --apply-as-patch option to git-p4 submit
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-21 10:11:20 +01:00