1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-05 08:47:56 +01:00
Commit graph

12736 commits

Author SHA1 Message Date
Junio C Hamano
bd46c9a912 builtin-tag: accept and process multiple -m just like git-commit
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 23:18:09 -08:00
Junio C Hamano
3f7dfe77b7 git-branch --contains: doc and test
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 22:11:28 -08:00
Junio C Hamano
694a577519 git-branch --contains=commit
This teaches git-branch to limit its listing to branches that
are descendants to the named commit.

When you are using many topic branches, you often would want to
see which branch already includes a commit, so that you know
which can and cannot be rewound without disrupting other people.

One thing that sometimes happens to me is:

 * Somebody sends a patch that is a good maint material.  I
   apply it to 'maint':

     $ git checkout maint
     $ git am -3 -s obvious-fix.patch

 * Then somebody else sends another patch that is possibly a
   good maint material, but I'd want to cook it in 'next' to be
   extra sure.  I fork a topic from 'maint' and apply the patch:

     $ git checkout -b xx/maint-fix-foo
     $ git am -3 -s ,xx-maint-fix-foo.patch

 * A minor typo is found in the "obvious-fix.patch".

The above happens without pushing the results out, so I can
freely recover from it by amending 'maint', as long as I do not
forget to rebase the topics that were forked previously.

With this patch, I can do this to find out which topic
branches already contain the faulty commit:

    $ git branch --contains=maint^
      xx/maint-fix-foo

so I can rebase the xx/maint-fix-foo branch before merging it
to 'next'.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 22:11:28 -08:00
Pierre Habouzit
dd3bf0f4a5 parse-options: Allow to hide options from the default usage.
This is useful for backward-compatibility aliases, or very advanced command
line switches introduced for internal git usages and have no real use for a
user.

parse-options still shows them if the user asks for --help-all.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 22:11:28 -08:00
Junio C Hamano
12db334e75 git-add -i: allow multiple selection in patch subcommand
This allows more than one files from the list to be chosen from
the patch subcommand instead of going through the file one by
one.

This also updates the "list-and-choose" UI for usability.  When
the prompt ends with ">>", if you type '*' to choose all
choices, the prompt immediately returns the choice without
requiring an extra empty line to confirm the selection.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 18:23:55 -08:00
Junio C Hamano
31e7bded60 Addendum to "MaintNotes"
Add "how to maintain git" document. Foreward by Jeff King.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:41:45 -08:00
Kristian Høgsberg
99a1269458 builtin-commit: Include the diff in the commit message when verbose.
run_diff_index() and the entire diff machinery is hard coded to output
to stdout, so just redirect that and restore it when done.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:05 -08:00
Junio C Hamano
2888605c64 builtin-commit: fix partial-commit support
When making a partial-commit, we need to prepare two index
files, one to be used to write out the tree to be committed
(temporary index) and the other to be used as the index file
after the commit is made.

The temporary index needs to be initialized to HEAD and then all
the named paths on the command line need to be staged on top of
the index.  For this, running add_files_to_cache() that compares
what is in the index and the paths given from the command line
is not enough -- the comparison will miss the paths that the
user previously ran "git add" to the index since the HEAD
because the index reset to the HEAD would not know about them.
The index file needs to get the same modification done when
preparing the temporary index as described above.

This implementation mimics the behaviour of the scripted
version of git-commit.  It first runs overlay_tree_on_cache(),
which was stolen from ls-files with the earlier change, to get
the list of paths that the user can potentially mean, and then
uses pathspec_match() to find which ones the user meant.  This
list of paths is used to update both the temporary and the real
index file.

Additional fixes are:

 - read the index file after pre-commit hook returns, as the
   hook can modify it to affect the contents of the commit.

 - remove the temporary index file .git/next-index-* after
   commit is done or aborted.

 - run post-commit hook with the real index file to be used
   after the commit (previously it gave the temporary commit if
   a partial commit was made).

 - resurrect the safety mechanism to refuse partial commits
   during a merge to match the scripted version.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:05 -08:00
Junio C Hamano
b6ec1d619f Fix add_files_to_cache() to take pathspec, not user specified list of files
This separates the logic to limit the extent of change to the
index by where you are (controlled by "prefix") and what you
specify from the command line (controlled by "pathspec").

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:05 -08:00
Junio C Hamano
ee425e4643 Export three helper functions from ls-files
This exports three helper functions from ls-files.

 * pathspec_match() checks if a given path matches a set of pathspecs
   and optionally records which pathspec was used.  This function used
   to be called "match()" but renamed to be a bit less vague.

 * report_path_error() takes a set of pathspecs and the record
   pathspec_match() above leaves, and gives error message.  This
   was split out of the main function of ls-files.

 * overlay_tree_on_cache() takes a tree-ish (typically "HEAD")
   and overlays it on the current in-core index.  By iterating
   over the resulting index, the caller can find out the paths
   in either the index or the HEAD.  This function used to be
   called "overlay_tree()" but renamed to be a bit more
   descriptive.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:05 -08:00
Junio C Hamano
e06ad5ffb9 builtin-commit: run commit-msg hook with correct message file
It should run with $GIT_DIR/COMMIT_EDITMSG, not just COMMIT_EDITMSG.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:04 -08:00
Junio C Hamano
bc5d248a9f builtin-commit: do not color status output shown in the message template
Noticed by Ping Yin on the list.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:04 -08:00
Junio C Hamano
a50f9fc5fe file_exists(): dangling symlinks do exist
This function is used to see if a path given by the user does exist
on the filesystem.  A symbolic link that does not point anywhere does
exist but running stat() on it would yield an error, and it incorrectly
said it does not exist.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:04 -08:00
Johannes Schindelin
637efc3456 Replace "runstatus" with "status" in the tests
We no longer have "runstatus", but running "status" is no longer that
expensive anyway; it is a builtin.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:04 -08:00
Kristian Høgsberg
1200993a1e t7501-commit: Add test for git commit <file> with dirty index.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:04 -08:00
Kristian Høgsberg
18abc2dba4 builtin-commit: Clean up an unused variable and a debug fprintf().
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:04 -08:00
Kristian Høgsberg
ef12b50d0c Call refresh_cache() when updating the user index for --only commits.
We're guaranteeing the user that the index will be stat-clean after
git commit. Thus, we need to call refresh_cache() for the user index too,
in the 'git commit <paths>' case.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:03 -08:00
Johannes Schindelin
129fa60636 builtin-commit: Add newline when showing which commit was created
The function log_tree_commit() does not break the line, so we have to
do it ourselves.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:03 -08:00
Johannes Schindelin
f9568530c9 builtin-commit: resurrect behavior for multiple -m options
When more than one -m option is given, the message does not replace
the previous, but is appended as a new paragraph.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:03 -08:00
Johannes Schindelin
2150554b0e builtin-commit --s: add a newline if the last line was not a S-o-b
The rule is this: if the last line already contains the sign off by the
current committer, do nothing.  If it contains another sign off, just
add the sign off of the current committer.  If the last line does not
contain a sign off, add a new line before adding the sign off.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:03 -08:00
Johannes Schindelin
13208572fb builtin-commit: fix --signoff
The Signed-off-by: line contained a spurious timestamp.  The reason was
a call to git_committer_info(1), which automatically added the
timestamp.

Instead, fmt_ident() was taught to interpret an empty string for the
date (as opposed to NULL, which still triggers the default behavior)
as "do not bother with the timestamp", and builtin-commit.c uses it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:03 -08:00
Johannes Schindelin
367c98866c git status: show relative paths when run in a subdirectory
To show the relative paths, the function formerly called quote_crlf()
(now called quote_path()) takes the prefix as an additional argument.

While at it, the static buffers were replaced by strbufs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:03 -08:00
Kristian Høgsberg
d37d320386 builtin-commit: Refresh cache after adding files.
We have promised our users that after running git-status or
git-commit the index will be refreshed for a long time since
these commands were introduced.  Do refresh the index before
writing it out to keep the promise.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:03 -08:00
Johannes Schindelin
741707b1e2 builtin-commit: fix reflog message generation
Instead of strdup()ing, we can just reuse the buffer in which the
commit message is stored, and which is supposed to hold the reflog
message anyway.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:02 -08:00
Johannes Schindelin
e97c9ad96b launch_editor(): read the file, even when EDITOR=:
Earlier we just returned in case EDITOR=: but the message stored
in the file was not read back.  Fix this, at the same time
simplifying the code as suggested by Johannes Sixt.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:05:02 -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
Kristian Høgsberg
943316e96c Export launch_editor() and make it accept ':' as a no-op editor.
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
Kristian Høgsberg
d63c2fd192 Add testcase for amending and fixing author in git commit.
We used to clobber author time, but we shouldn't.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 17:04:56 -08:00
Junio C Hamano
193f7e98da Make test scripts executable. 2007-11-22 16:52:17 -08:00
Junio C Hamano
fa30383642 Merge branch 'maint'
* maint:
  Make test scripts executable.
  bundle create: keep symbolic refs' names instead of resolving them
2007-11-22 16:51:18 -08:00
Junio C Hamano
958e67c0a8 Make test scripts executable. 2007-11-22 16:48:55 -08:00
Johannes Schindelin
6047a234c5 rebase -i: move help to end of todo file
[PATCH] rebase -i: move help to end of todo file

Many editors start in the first line, so the 9-line help text was an
annoyance.  So move it to the end.

Requested by Junio.

While at it, add a hint how to abort the rebase.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 15:35:06 -08:00
Johannes Schindelin
c5546e88fe bundle create: keep symbolic refs' names instead of resolving them
When creating a bundle, symbolic refs used to be resolved to the
non-symbolic refs they point to before being written to the list
of contained refs.  I.e. "git bundle create a1.bundle HEAD master"
would show something like

388afe7881b33102fada216dd07806728773c011        refs/heads/master
388afe7881b33102fada216dd07806728773c011        refs/heads/master

instead of

388afe7881b33102fada216dd07806728773c011        HEAD
388afe7881b33102fada216dd07806728773c011        refs/heads/master

Introduce a special handling so that the symbolic refs are listed
with the names passed on the command line.

Noticed by Santi Béjar.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 15:15:25 -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
Wincent Colaiuta
4c8416847a Add path-limiting to git-add--interactive
Implement Junio's suggestion that git-add--interactive should reproduce the
path-limiting semantics of non-interactive git-add.

In otherwords, if "git add -i" (unrestricted) shows paths from a set A,
"git add -i paths..." should show paths from a subset of the set A and that
subset should be defined with the existing ls-files pathspec semantics.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 02:53:40 -08:00
Wincent Colaiuta
7c0ab44589 Teach builtin-add to pass multiple paths to git-add--interactive
Instead of just accepting a single file parameter, git-add now accepts
any number of path parameters, fowarding them to git-add--interactive.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 02:53:19 -08:00
Wincent Colaiuta
a7d9da6c97 Refactor patch_update_cmd
Split patch_update_cmd into two functions, one to prompt the user for
a path to patch and another to do the actual work given that file path.
This lays the groundwork for a future commit which will teach
git-add--interactive to accept a path parameter and jump directly to
the patch subcommand for that path, bypassing the interactive prompt.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 00:51:56 -08:00
Wincent Colaiuta
5f5b611805 Authenticate only once in git-send-email
When using git-send-email with SMTP authentication sending a patch series
would redundantly authenticate multiple times, once for each patch. In
the worst case, this would actually prevent the series from being sent
because the server would reply with a "5.5.0 Already Authenticated"
status code which would derail the process.

This commit teaches git-send-email to authenticate once and only once at
the beginning of the series.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 00:50:21 -08:00
Junio C Hamano
060009b419 Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn:
  git-svn: allow `info' command to work offline
  git-svn: info --url [path]
  git-svn info: implement info command
  git-svn: extract reusable code into utility functions
  t9106: fix a race condition that caused svn to miss modifications
2007-11-22 00:34:49 -08:00
Junio C Hamano
f8b6809d52 Fix "quote" misconversion for rewrite diff output.
663af3422a (Full rework of
quote_c_style and write_name_quoted.) mistakenly used puts()
when writing out a fixed string when it did not want to add a
terminating LF.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-21 23:06:44 -08:00
Eric Wong
a5460eb7bb git-svn: allow `info' command to work offline
Cache the repository root whenever we connect to the repository.
This will allow us to notice URL changes if the user changes the
URL in .git/config, too.

If the repository is no longer accessible, or if `git svn info'
is the first and only command run; then '(offline)' will be
displayed for "Repository Root:" in the output.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-11-21 20:11:11 -08:00
David D. Kilzer
8b014d7157 git-svn: info --url [path]
Return the svn URL for the given path, or return the svn
repository URL if no path is given.

Added 18 tests to t/t9119-git-svn-info.sh.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-21 20:11:11 -08:00
David D. Kilzer
e6fefa926d git-svn info: implement info command
Implement "git-svn info" for files and directories based on the
"svn info" command.  Note that the -r/--revision argument is not
supported yet.

Added 18 tests in t/t9119-git-svn-info.sh.

[ew: small fix to work without arguments on all working directories]

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-21 20:11:11 -08:00
David D. Kilzer
b2b3ada7fc git-svn: extract reusable code into utility functions
Extacted canonicalize_path() in the main package.

Created new Git::SVN::Util package with an md5sum() function.  A
new package was created so that Digest::MD5 did not have to be
loaded in the main package.  Replaced code in the SVN::Git::Editor
and SVN::Git::Fetcher packages with calls to md5sum().

Extracted the format_svn_date(), parse_git_date() and
set_local_timezone() functions within the Git::SVN::Log package.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-21 20:11:11 -08:00
Eric Wong
8d92f24852 t9106: fix a race condition that caused svn to miss modifications
carbonated beverage noticed this test was occasionally failing.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-11-21 20:11:11 -08:00
Junio C Hamano
d794d9e70e Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui: (96 commits)
  git-gui 0.9.0
  git-gui: Bind Meta-T for "Stage To Commit" menu action
  git-gui: Allow users to set font weights to bold
  git-gui: Update Japanese strings (part 2)
  git-gui: Update Japanese strings
  Updated russian translation of git-gui
  po2msg: actually output statistics
  po2msg: ignore untranslated messages
  po2msg: ignore entries marked with "fuzzy"
  git-gui: Protect against bad translation strings
  git-gui: Make sure we get errors from git-update-index
  More updates and corrections to the russian translation of git-gui
  Updated Russian translation.
  git-gui: Update German translation
  git-gui: Add more terms to glossary.
  git-gui: Paper bag fix the global config parsing
  git-gui: Honor a config.mak in git-gui's top level
  git-gui: Collapse $env(HOME) to ~/ in recent repositories on Windows
  git-gui: Support cloning Cygwin based work-dirs
  git-gui: Use proper Windows shortcuts instead of bat files
  ...
2007-11-21 00:00:56 -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
Jeff King
07f507155d send-pack: cluster ref status reporting
Instead of intermingling success and failure, we now print:

  1. all uptodate refs (if args.verbose is enabled)
  2. successfully pushed refs
  3. failed refs

with the assumption that the user is most likely to see the
ones at the end, and therefore we order them from "least
interesting" to "most interesting."

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-20 23:25:31 -08:00
Jeff King
b9c506f7d9 avoid "defined but not used" warning for fetch_objs_via_walker
Because this function is static and used only by the
http-walker, when NO_CURL is defined, gcc emits a "defined
but not used" warning.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-20 23:11:00 -08:00
Shawn O. Pearce
41188dd1a8 git-gui 0.9.0
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-11-21 02:10:03 -05:00