Commit graph

5524 commits

Author SHA1 Message Date
Eric Wong f0ef05967f rebase: check for errors from git-commit
commit does not always succeed, so we'll have to check for
it in the absence of set -e.  This fixes a regression
introduced in 9e4bc7dd1b

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:54:31 -07:00
Martin Langhoff c5f448b0f2 cvsimport - cleanup of the multi-indexes handling
Indexes are only needed when we are about preparing to commit. Prime them
inside commit() when we have all the info we need, and remove all the
redundant index setups.

While we are at it, make sure that index handling is correct when opening
new branches, and on initial import.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:53:37 -07:00
Junio C Hamano 3b44f15a35 connect.c: check the commit buffer boundary while parsing.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:51:00 -07:00
Junio C Hamano c78963d280 connect.c: remove unused parameters from tcp_connect and proxy_connect
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:50:33 -07:00
Timo Hirvonen 554fe20d80 Make some strings const
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:24:37 -07:00
Eric Wong 66eb64cba6 rebase: get rid of outdated MRESOLVEMSG
There was a time when rebase --skip didn't work when used with
--merge, but that is no more so we don't need that message
anymore.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:20:51 -07:00
Andreas Ericsson 33ebb8717f git wrapper: fix command name in an error message.
When the command execution by execv_git_cmd() fails with an errno
other than ENOENT, we used an uninitialized variable instead of
the string that holds the command name to report what failed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:20:51 -07:00
Eric Wong 80f50749da git-svn: be verbose by default on fetch/commit, add -q/--quiet option
Slower connections can make git-svn look as if it's doing
nothing for a long time; leaving the user wondering if we're
actually doing anything.  Now we print some file progress just
to assure the user that something is going on while they're
waiting.

Added the -q/--quiet option to users to revert to the old method
if they preferred it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:20:51 -07:00
Eric Wong a00439acd2 git-svn: add --follow-parent and --no-metadata options to fetch
--follow-parent:
  This is especially helpful when we're tracking a directory
  that has been moved around within the repository, or if we
  started tracking a branch and never tracked the trunk it was
  descended from.

  This relies on the SVN::* libraries to work.  We can't
  reliably parse path info from the svn command-line client
  without relying on XML, so it's better just to have the SVN::*
  libs installed.

  This also removes oldvalue verification when calling update-ref

  In SVN, branches can be deleted, and then recreated under the
  same path as the original one with different ancestry
  information, causing parent information to be mismatched /
  misordered.

  Also force the current ref, if existing, to be a parent,
  regardless of whether or not it was specified.

--no-metadata:
  This gets rid of the git-svn-id: lines at the end of every commit.

  With this, you lose the ability to use the rebuild command.  If
  you ever lose your .git/svn/git-svn/.rev_db file, you won't be
  able to fetch again, either.  This is fine for one-shot imports.

  Also fix some issues with multi-fetch --follow-parent that were
  exposed while testing this.  Additionally, repack checking is
  simplified greatly.

  git-svn log will not work on repositories using this, either.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:20:50 -07:00
Eric Wong 27e9fb8d41 git-svn: add the commit-diff command
This is intended for interoperability with git-svnimport.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:20:50 -07:00
Eric Wong c1927a8554 git-svn: several graft-branches improvements
The 'graft-branches' command can now analyze tree matches for
merge detection after commits are done, when --branch or
--branch-all-refs options are used.

We ensure that tree joins (--branch and --branch-all-refs
options) during commit time only add SVN parents that occurred
before the commit we're importing

Also fixed branch detection via merge messages, this manner of
merge detection (a la git-svnimport) is really all fuzzy, but at
least it actually works now :)

Add some new tests to go along with these fixes, too.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:20:50 -07:00
Eric Wong dc62e25cbd git-svn: SVN 1.1.x library compatibility
Tested on a plain Ubuntu Hoary installation
using subversion 1.1.1-2ubuntu3

1.1.x issues I had to deal with:

* Avoid the noisy command-line client compatibility check if we
  use the libraries.

* get_log() arguments differ (now using a nice wrapper from
  Junio's suggestion)

* get_file() is picky about what kind of file handles it gets,
  so I ended up redirecting STDOUT.  I'm probably overflushing
  my file handles, but that's the safest thing to do...

* BDB kept segfaulting on me during tests, so svnadmin will use FSFS
  whenever we can.

* If somebody used an expanded CVS $Id$ line inside a file, then
  propsetting it to use svn:keywords will cause the original CVS
  $Id$ to be retained when asked for the original file.  As far as
  I can see, this is a server-side issue.  We won't care in the
  test anymore, as long as it's not expanded by SVN, a static
  CVS $Id$ line is fine.

While we're at making ourselves more compatible, avoid grep
along with the -q flag, which is GNU-specific. (grep avoidance
tip from Junio, too)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:20:29 -07:00
Junio C Hamano 2386c2975d combine-diff.c: type sanity
- combine_diff() took cnt (count) which is unsigned in nature but the
  parameter type was declared as "int";
- find_next() took "uninteresting" parameter, which masked a static
  function of the same name;
- show_parent_lno() took an unused parameter "cnt";
- show_patch_diff() used a local variable in nested inner scope with
  the same name with different type, masking the one in the outer scope;
- the last loop in show_patch_diff iterated over lines so it should use
  the local variable "lno"

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 01:38:19 -07:00
Jeff King 8dcaefb52f quote.c: silence compiler warnings from EMIT macro
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 01:18:18 -07:00
Johannes Schindelin 81db094107 format-patch: use clear_commit_marks() instead of some ad-hockery
It is cleaner, and it describes better what the idea behind the code is.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-27 16:03:59 -07:00
Junio C Hamano 9e76bab14e t4013 test updates for new output code.
These are updates to the test vector that shows the "incompatibility" of
the new output code.  The changes are actually the good ones, so instead
of keeping the older output we adjust the test to the new code.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-27 15:36:19 -07:00
Junio C Hamano 3969cf7db1 Fix some more diff options changes.
This fixes various problems in the new diff options code.

 - Fix --cc/-c --patch; it showed two-tree diff used internally.

 - Use "---\n" only where it matters -- that is, use it
   immediately after the commit log text when we show a
   commit log and something else before the patch text.

 - Do not output spurious extra "\n"; have an extra newline
   after the commit log text always when we have diff output and
   we are not doing oneline.

 - When running a pickaxe you need to go recursive.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-27 15:33:40 -07:00
Junio C Hamano a959e0dc16 Merge branch 'jc/diff-test' into th/diff
* jc/diff-test:
  t4013: add more tests around -c and --cc
  t4013: add tests for diff/log family output options.
2006-06-27 11:05:02 -07:00
Timo Hirvonen 3223847a8f Fix diff-tree -s
setup_revisions() calls diff_setup_done() before we can set default
value for output_format.  Don't convert DIFF_FORMAT_NO_OUTPUT to 0 in
diff_setup_done(), it is useless and makes diff-tree believe no diff
format parameters were given and thus lets it reset output_format to
DIFF_FORMAT_RAW.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-27 11:04:47 -07:00
Timo Hirvonen 1798562745 log --raw: Don't descend into subdirectories by default
Only do so when -r is given.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-27 11:04:16 -07:00
Timo Hirvonen f005df3910 diff-tree: Use ---\n as a message separator
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-27 11:03:41 -07:00
Timo Hirvonen 946c3784a3 Print empty line between raw, stat, summary and patch
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-27 10:59:34 -07:00
Dennis Stosberg 8096fae726 Fix expr usage for FreeBSD
Some implementations of "expr" (e.g. FreeBSD's) fail, if an
argument starts with a dash.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-27 10:56:05 -07:00
Johannes Schindelin 8780bd8fd2 t4014: fix for whitespace from "wc -l"
Some "wc" insist on putting a TAB in front of the number.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-27 10:55:33 -07:00
Junio C Hamano 47979d5d5b t4013: add more tests around -c and --cc
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 23:29:11 -07:00
Junio C Hamano ece3c67f9c t4014: add format-patch --ignore-if-in-upstream test
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 15:40:09 -07:00
Timo Hirvonen 9dafea2678 whatchanged: Default to DIFF_FORMAT_RAW
Split cmd_log_wc() to cmd_log_init() and cmd_log_walk() and set default
diff output format for whatchanged to DIFF_FORMAT_RAW.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 14:58:41 -07:00
Timo Hirvonen 5e2b0636c7 Don't xcalloc() struct diffstat_t
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 14:58:41 -07:00
Timo Hirvonen 39bc9a6c20 Add msg_sep to diff_options
Add msg_sep variable to struct diff_options.  msg_sep is printed after
commit message.  Default is "\n", format-patch sets it to "---\n".

This also removes the second argument from show_log() because all
callers derived it from the first argument:

    show_log(rev, rev->loginfo, ...

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 14:58:41 -07:00
Timo Hirvonen 0e677e1a6b DIFF_FORMAT_RAW is not default anymore
diff_setup() used to initialize output_format to DIFF_FORMAT_RAW.  Now
the default is 0 (no output) so don't compare against DIFF_FORMAT_RAW to
see if any diff format command line flags were given.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 14:58:41 -07:00
Timo Hirvonen c9b5ef998a Set default diff output format after parsing command line
Initialize output_format to 0 instead of DIFF_FORMAT_RAW so that we can see
later if any command line options changed it.  Default value is set only if
output format was not specified.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 14:58:40 -07:00
Timo Hirvonen a610786f4b Make --raw option available for all diff commands
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 14:58:40 -07:00
Timo Hirvonen c6744349df Merge with_raw, with_stat and summary variables to output_format
DIFF_FORMAT_* are now bit-flags instead of enumerated values.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 14:58:40 -07:00
Johannes Schindelin 9c6efa366e format-patch: introduce "--ignore-if-in-upstream"
With this flag, format-patch will try very hard not to output patches which
are already in the upstream branch.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 14:44:04 -07:00
Johannes Schindelin fcb3d0adc1 add diff_flush_patch_id() to calculate the patch id
Call it like this:

unsigned char id[20];
if (diff_flush_patch_id(diff_options, id))
	printf("And the patch id is: %s\n", sha1_to_hex(id));

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 14:44:03 -07:00
Junio C Hamano 3c2f75b590 t4013: add tests for diff/log family output options.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 14:36:40 -07:00
Junio C Hamano 1ef9e05dbf Merge branch 'jc/squash'
* jc/squash:
  git-merge --squash
2006-06-26 14:36:10 -07:00
Junio C Hamano 6a0dbb8a5c Merge branch 'jc/diff'
* jc/diff:
  diff --color: use $GIT_DIR/config
2006-06-26 14:36:02 -07:00
Junio C Hamano 9f9817e34a Merge branch 'ml/cvsimport'
* ml/cvsimport:
  cvsimport: always set $ENV{GIT_INDEX_FILE} to $index{$branch}
  cvsimport: setup indexes correctly for ancestors and incremental imports
2006-06-26 14:35:33 -07:00
Junio C Hamano 2cc06a0500 Merge branch 'js/diff'
* js/diff:
  Teach diff about -b and -w flags
2006-06-26 14:28:42 -07:00
Junio C Hamano 57be46fd21 Merge branch 'ew/rebase'
* ew/rebase:
  rebase: allow --skip to work with --merge
  rebase: cleanup rebasing with --merge
  rebase: allow --merge option to handle patches merged upstream
2006-06-26 14:05:13 -07:00
Dennis Stosberg 07d68930c2 Fix pkt-line.h to compile with a non-GCC compiler
pkt-line.h uses GCC's __attribute__ extension but does not include
git-compat-util.h.  So it will not compile with a compiler that does
not support this extension.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 02:11:53 -07:00
Dennis Stosberg e898081dfb Solaris needs inclusion of signal.h for signal()
Currently the compilation fails in connect.c and merge-index.c

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26 02:11:44 -07:00
Matthias Lederhofer 3acb27b6a4 correct documentation for git grep
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-25 10:09:19 -07:00
Junio C Hamano 2ad47d61b9 git-repack: Be careful when updating the same pack as an existing one.
After a clone, packfiles are read-only by default and "mv" to
replace the pack with a new one goes interactive, asking if the
user wants to replace it.  If one is successfully moved and the
other is not, the pack and its idx would become out-of-sync and
corrupts the repository.

Recovering is straightforward -- it is just the matter of
finding the remaining .tmp-pack-* and make sure they are both
moved -- but we should be extra careful not to do something so
alarming to the users.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-25 05:28:58 -07:00
Junio C Hamano 801235c5e6 diff --color: use $GIT_DIR/config
This lets you use something like this in your $GIT_DIR/config
file.

	[diff]
		color = auto

	[diff.color]
		new = blue
		old = yellow
		frag = reverse

When diff.color is set to "auto", colored diff is enabled when
the standard output is the terminal.  Other choices are "always",
and "never".  Usual boolean true/false can also be used.

The colormap entries can specify colors for the following slots:

	plain	- lines that appear in both old and new file (context)
	meta	- diff --git header and extended git diff headers
	frag	- @@ -n,m +l,k @@ lines (hunk header)
	old	- lines deleted from old file
	new	- lines added to new file

The following color names can be used:

	normal, bold, dim, l, blink, reverse, reset,
	black, red, green, yellow, blue, magenta, cyan,
	white

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-25 00:39:13 -07:00
Eric Wong d5e673b60b rebase: allow --skip to work with --merge
Now that we control the merge base selection, we won't be forced
into rolling things in that we wanted to skip beforehand.

Also, add a test to ensure this all works as intended.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-25 00:38:34 -07:00
Eric Wong 9e4bc7dd1b rebase: cleanup rebasing with --merge
We no longer have to recommit each patch to remove the parent
information we're rebasing since we're using the low-level merge
strategies directly instead of git-merge.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-25 00:38:34 -07:00
Eric Wong 9a99c087da rebase: allow --merge option to handle patches merged upstream
Enhance t3401-rebase-partial to test with --merge as well as
the standard am -3 strategy.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-25 00:38:34 -07:00
Yann Dirson 29f4ad867c git-commit: filter out log message lines only when editor was run.
The current behaviour strips out lines starting with a # even when fed
through stdin or -m.  This is particularly bad when importing history from
another SCM (tailor 0.9.23 uses git-commit).  In the best cases all lines
are stripped and the commit fails with a confusing "empty log message"
error, but in many cases the commit is done, with loss of information.

Note that it is quite peculiar to just have "#" handled as a leading
comment char here.  One commonly meet CVS: or CG: or STG: as prefixes, and
using GIT: would be more robust as well as consistent with other commit
tools.  However, that would break any tool relying on the # (if any).

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-25 00:35:52 -07:00