1
0
mirror of https://github.com/git/git.git synced 2024-10-05 15:01:39 +02:00
Commit Graph

11936 Commits

Author SHA1 Message Date
Johannes Schindelin
7155b727c9 Introduce remove_dir_recursively()
There was a function called remove_empty_dir_recursive() buried
in refs.c.  Expose a slightly enhanced version in dir.h: it can now
optionally remove a non-empty directory.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-30 00:04:39 -07:00
Junio C Hamano
90446a0009 bundle transport: fix an alloc_ref() call
Currently alloc_ref() expects the length of the refname plus 1
as its parameter, prepares that much space and returns a "ref"
structure for the caller to fill the refname.  One caller in
transport.c::get_refs_from_bundle() however allocated one byte
less.

It may be a good idea to change the calling convention to give
alloc_ref() the length of the refname, but that clean-up can be
done in a separate patch.  This patch only fixes the bug and
makes all callers consistent.

There was also one overallocation in connect.c, which would not
hurt but was wasteful.  This patch fixes it as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:54:37 -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
Daniel Barkalow
fe50eef59b Fix adding a submodule with a remote url
Without this, a non-path URL gets lost before the clone.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:36:02 -07:00
Jari Aalto
6982ccecaf git-remote: exit with non-zero status after detecting error in "rm".
Exit with non-zero status when "git remote rm" was told to
remove a non-existing remote.

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:34:19 -07:00
Junio C Hamano
2af89f12c6 Merge branch 'maint'
* maint:
  git-remote: exit with non-zero status after detecting errors.
  rebase -i: squash should retain the authorship of the _first_ commit
  git-add--interactive: Improve behavior on bogus input
  git-add--interactive: Allow Ctrl-D to exit
2007-09-29 23:32:36 -07:00
Jari Aalto
f4bb20cc99 git-remote: exit with non-zero status after detecting errors.
Some subcommands of "git-remote" detected and issued error
messages but did not signal that to the calling process with
exit status.

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:32:31 -07:00
Johannes Schindelin
81ab1cb43a rebase -i: squash should retain the authorship of the _first_ commit
It was determined on the mailing list, that it makes more sense for a
"squash" to keep the author of the first commit as the author for the
result of the squash.

Make it so.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:16:08 -07:00
Johannes Schindelin
f8babc4dab rebase -i: support single-letter abbreviations for the actions
When you do many rebases, you can get annoyed by having to type out
the actions "edit" or "squash" in total.

This commit helps that, by allowing you to enter "e" instead of "edit",
"p" instead of "pick", or "s" instead of "squash".

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:15:50 -07:00
Jean-Luc Herren
6a6eb3d09f git-add--interactive: Improve behavior on bogus input
1) Previously, any menu would cause a perl error when entered '0',
   which is never a valid option.

2) Entering a bogus choice (like 998 or 4-2) surprisingly caused
   the same behavior as if the user had just hit 'enter', which
   means to carry out the selected action on the selected items.
   Entering such bogus input is now a no-op and the sub-menu
   doesn't exit.

Signed-off-by: Jean-Luc Herren <jlh@gmx.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:14:17 -07:00
Jean-Luc Herren
c95c02486c git-add--interactive: Allow Ctrl-D to exit
Hitting Ctrl-D (EOF) is a common way to exit shell-like tools.
When in a sub-menu it will still behave as if an empty line had
been entered, carrying out the action on the selected items and
returning to the previous menu.

Signed-off-by: Jean-Luc Herren <jlh@gmx.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 23:14:16 -07:00
Daniel Barkalow
cfb8f898a8 Allow abbreviations in the first refspec to be merged
The config item for a refspec side and the ref name that it matches
aren't necessarily character-for-character identical. We actually want
to merge a ref by default if: there is no per-branch config, it is the
found result of looking for the match for the first refspec, and the
first refspec is not a pattern. Beyond that, anything that
get_fetch_map() thinks matches is fine.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 22:11:52 -07:00
Pierre Habouzit
9a76adebd6 Make read_patch_file work on a strbuf.
So that we don't need to use strbuf_detach.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 21:39:29 -07:00
Pierre Habouzit
387e7e19d7 strbuf_read_file enhancement, and use it.
* make strbuf_read_file take a size hint (works like strbuf_read)
* use it in a couple of places.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 21:26:10 -07:00
Josh England
1abbe475ff post-checkout hook, tests, and docs
Updated post-checkout hook to take a flag specifying whether the checkout is
a branch checkout or a file checkout (from the index).

Signed-off-by: Josh England <jjengla@sandia.gov>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 21:11:21 -07:00
Junio C Hamano
1f08819101 git-am: make the output quieter.
We used to say "Applying <patch subject>", "Wrote <tree
object>", and "Committed <commit object>".  Worse yet, with
extra blank lines around them.

Make the output more concise.  The object names are not so
useful nor interesting.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 20:45:33 -07:00
Andy Parkins
d392e712a8 Make for-each-ref's grab_date() support per-atom formatting
grab_date() gets an extra parameter - atomname; this extra parameter is
checked to see if it has a ":<format>" extra component in it, and if so
that "<format>" string is passed to parse_date_format() to produce an
enum date_mode value which is then further passed to show_date().

In short it allows the user of git-for-each-ref to do things like this:

 $ git-for-each-ref --format='%(taggerdate:default)' refs/tags/v1.5.2
 Sun May 20 00:30:42 2007 -0700
 $ git-for-each-ref --format='%(taggerdate:relative)' refs/tags/v1.5.2
 4 months ago
 $ git-for-each-ref --format='%(taggerdate:short)' refs/tags/v1.5.2
 2007-05-20
 $ git-for-each-ref --format='%(taggerdate:local)' refs/tags/v1.5.2
 Sun May 20 08:30:42 2007
 $ git-for-each-ref --format='%(taggerdate:iso8601)' refs/tags/v1.5.2
 2007-05-20 00:30:42 -0700
 $ git-for-each-ref --format='%(taggerdate:rfc2822)' refs/tags/v1.5.2
 Sun, 20 May 2007 00:30:42 -0700

The default, when no ":<format>" is specified is ":default", leaving the
existing behaviour unchanged.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 20:31:59 -07:00
Andy Parkins
b64265ca8d Make for-each-ref allow atom names like "<name>:<something>"
In anticipation of supplying a per-field date format specifier, this
patch makes parse_atom() in builtin-for-each-ref.c allow atoms that have
a valid atom name (as determined by the valid_atom[] table) followed by
a colon, followed by an arbitrary string.

The arbitrary string is where the format for the atom will be specified.

Note, if different formats are specified for the same atom, multiple
entries will be made in the used_atoms table to allow them to be
distinguished by the grab_XXXX() functions.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 20:31:59 -07:00
Andy Parkins
856665f827 parse_date_format(): convert a format name to an enum date_mode
Factor out the code to parse --date=<format> parameter to revision
walkers into a separate function, parse_date_format().  This function
is passed a string and converts it to an enum date_format:

 - "relative"         => DATE_RELATIVE
 - "iso8601" or "iso" => DATE_ISO8601
 - "rfc2822"          => DATE_RFC2822
 - "short"            => DATE_SHORT
 - "local"            => DATE_LOCAL
 - "default"          => DATE_NORMAL

In the event that none of these strings is found, the function die()s.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 20:31:59 -07:00
Junio C Hamano
2a858ee951 Merge branch 'gr/smtp'
* gr/smtp:
  send-email --smtp-server-port: allow overriding the default port
2007-09-29 16:44:44 -07:00
Junio C Hamano
3a229177f9 Merge branch 'ss/svnimport'
* ss/svnimport:
  Fix pool handling in git-svnimport to avoid memory leaks.
2007-09-29 16:44:25 -07:00
Junio C Hamano
6b4790db24 Merge branch 'sv/svn'
* sv/svn:
  git-svn: handle changed svn command-line syntax
  git-svn: fix test for trunk svn (transaction out of date)
  git-svn: fix test for trunk svn (commit message not needed)
2007-09-29 16:43:23 -07:00
Junio C Hamano
2a350d7a68 Merge branch 'ml/submodule'
* ml/submodule:
  git-submodule - allow a relative path as the subproject url
2007-09-29 16:43:10 -07:00
Junio C Hamano
471fa1ecd5 Merge branch 'jb/remote-rm'
* jb/remote-rm:
  git-remote rm: add tests and minor fix-ups
  remote: document the 'rm' subcommand
  remote: add 'rm' subcommand
2007-09-29 16:43:06 -07:00
Junio C Hamano
ff08c373dc Merge branch 'jk/diff-rename'
* jk/diff-rename:
  diffcore-rename: cache file deltas
2007-09-29 16:42:50 -07:00
Junio C Hamano
d7da5597a8 Sync with GIT 1.5.3.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 16:31:40 -07:00
Junio C Hamano
552ce11006 GIT 1.5.3.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.5.3.3
2007-09-29 16:07:46 -07:00
Linus Torvalds
b7bb760d5e Fix revision log diff setup, avoid unnecessary diff generation
We used to incorrectly start calculating diffs whenever any argument but
'-z' was recognized by the diff options parsing. That was bogus, since not
all arguments result in diffs being needed, so we just waste a lot of time
and effort on calculating diffs that don't matter.

This actually also fixes another bug in "git log". Try this:

	git log -C

and notice how it prints an extra empty line in between log entries, even
though it never prints the actual diff (because we didn't ask for any diff
format, so the diff machinery never prints anything).

With this patch, that bogus empty line is gone, because "revs->diff" is
never set.  So this isn't just a "wasted time and effort" issue, it's also
a slight semantic fix.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 15:42:32 -07:00
Miklos Vajna
ee8245b54a git-bundle: fix commandline examples in the manpage
Multiple commands were displayed in one line, making the manpage hard to read.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 15:40:17 -07:00
Junio C Hamano
d3759c0805 Merge branch 'mergetool' of git://repo.or.cz/git/mergetool into maint
* 'mergetool' of git://repo.or.cz/git/mergetool:
  mergetool: Fix typo in options passed to kdiff3
  mergetool: fix emerge when running in a subdirectory
  Mergetool generating blank files (1.5.3)
2007-09-29 15:39:39 -07:00
Pierre Habouzit
b315c5c081 strbuf change: be sure ->buf is never ever NULL.
For that purpose, the ->buf is always initialized with a char * buf living
in the strbuf module. It is made a char * so that we can sloppily accept
things that perform: sb->buf[0] = '\0', and because you can't pass "" as an
initializer for ->buf without making gcc unhappy for very good reasons.

strbuf_init/_detach/_grow have been fixed to trust ->alloc and not ->buf
anymore.

as a consequence strbuf_detach is _mandatory_ to detach a buffer, copying
->buf isn't an option anymore, if ->buf is going to escape from the scope,
and eventually be free'd.

API changes:
  * strbuf_setlen now always works, so just make strbuf_reset a convenience
    macro.
  * strbuf_detatch takes a size_t* optional argument (meaning it can be
    NULL) to copy the buffer's len, as it was needed for this refactor to
    make the code more readable, and working like the callers.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 02:13:33 -07:00
Pierre Habouzit
690b61f5f1 double free in builtin-update-index.c
path_name is either ptr that should not be freed, or a pointer to a strbuf
buffer that is deallocated when exiting the loop. Don't do that !

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-29 01:40:19 -07:00
Theodore Ts'o
208fe3ac7e mergetool: Fix typo in options passed to kdiff3
Fix missing double hyphens in "-L1" and "-L2"

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-28 22:26:05 -04:00
Theodore Ts'o
f6e0e55934 mergetool: fix emerge when running in a subdirectory
Only pass the basename of the output filename when to emerge, since
emerge interprets non-absolute pathnames relative to the containing
directory of the output buffer.

Thanks to Kelvie Wong for pointing this out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-28 21:23:22 -04:00
Junio C Hamano
769f39861b Mergetool generating blank files (1.5.3)
When mergetool is run from a subdirectory, "ls-files -u" nicely
limits the output to conflicted files in that directory, but
we need to give the full path to cat-file plumbing to grab the
contents of stages.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-28 20:13:14 -04:00
Paul Mackerras
32f1b3e4a4 gitk: Fix the tab setting in the diff display window
This fixes the bug where we were using the wrong font to calculate
the width of the tab stops in the diff display window.

If we're running on Tk 8.5 we also use the new -tabstyle wordprocessor
option that makes tabs work as expected, i.e. a tab moves the cursor
to the right until the next tab stop is reached.  On Tk 8.5 we also
get fancy and set the first tab stop at column 1 for a normal diff
or column N for a merge diff with N parents.

On Tk8.4 we can't do that because the tabs work in the "tabular"
style, i.e. the nth tab character moves to the location of the nth
tab position, *unless* you ask for the default tab setting, which
gives 8-column tabs that work in the "wordprocessor" mode.  So on
Tk8.4 if the tab setting is 8 we ask for default tabs.  This means
that a tab setting of 7 or 9 can look quite different to 8 in some
cases.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-09-28 21:27:39 +10:00
Dan Nicholson
9f569fe58f quiltimport: Skip non-existent patches
When quiltimport encounters a non-existent patch in the series file,
just skip to the next patch. This matches the behavior of quilt.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-27 16:19:19 -07:00
Kristian Høgsberg
6d69b6f6ac Clean up stripspace a bit, use strbuf even more.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-27 00:33:33 -07:00
Kristian Høgsberg
a9390b9fce Add strbuf_read_file().
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-27 00:33:29 -07:00
Junio C Hamano
b4833a2c62 rerere: Fix use of an empty strbuf.buf
The code incorrectly assumed that strbuf.buf is always an
allocated piece of memory that has NUL at offset strbuf.len.
That assumption does not hold for a freshly initialized empty
strbuf.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26 23:34:01 -07:00
Paul Mackerras
bb3edc8b04 gitk: Add progress bars for reading in stuff and for finding
This uses the space formerly occupied by the find string entry field
to make a status label (unused for now) and a canvas to display a
couple of progress bars.  The bar for reading in commits is a short
green bar that oscillates back and forth as commits come in.  The
bar for showing the progress of a Find operation is yellow and advances
from left to right.

This also arranges to stop a Find operation if the user selects another
commit or pops up a context menu, and fixes the "highlight this" popup
menu items in the file list window.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-09-27 11:00:25 +10:00
Paul Mackerras
c73adce219 gitk: Fix a couple of bugs
insertrow and removerow were trying to adjust rowidlist, rowisopt
and rowfinal even if the row where we're inserting/deleting stuff
hasn't been laid out yet, which resulted in Tcl errors.  This fixes
that.

Also we weren't deleting the link$linknum tag in appendwithlinks,
which resulted in SHA1 IDs in the body of a commit message sometimes
getting shown in blue with underlining when they shouldn't.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-09-27 10:35:05 +10:00
Johannes Schindelin
26b2800768 apply: get rid of --index-info in favor of --build-fake-ancestor
git-am used "git apply -z --index-info" to find the original versions
of the files touched by the diff, to be able to do an inexpensive
three-way merge.

This operation makes only sense in a repository, since the index
information in the diff refers to blobs, which have to be present in
the current repository.

Therefore, teach "git apply" a mode to write out the result as an
index file to begin with, obviating the need for scripts to do it
themselves.

The sole user for --index-info is "git am" is converted to
use --build-fake-ancestor in this patch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26 13:42:10 -07:00
Carlos Rica
102c2338da Move make_cache_entry() from merge-recursive.c into read-cache.c
The function make_cache_entry() is too useful to be hidden away in
merge-recursive.  So move it to libgit.a (exposing it via cache.h).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26 13:42:10 -07:00
Junio C Hamano
44b2476a12 send-email --smtp-server-port: allow overriding the default port
You can use --smtp-server-port option to specify a port
different from the default (typically, SMTP servers listen
to smtp port 25 and ssmtp port 465).

Users should be aware that sending auth info over non-ssl
connections may be unsafe or just may not work at all
depending on SMTP server config.

Signed-off-by: Glenn Rempe <glenn@rempe.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26 13:27:45 -07:00
Pierre Habouzit
1dffb8fa80 Small cache_tree_write refactor.
This function cannot fail, make it void. Also make write_one act on a
const char* instead of a char*.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26 02:27:06 -07:00
Pierre Habouzit
8289b62095 Make builtin-rerere use of strbuf nicer and more efficient.
memory is now reused across hunks.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26 02:27:05 -07:00