1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-25 03:06:10 +02:00
Commit Graph

7967 Commits

Author SHA1 Message Date
Simon 'corecode' Schubert ca28370a35 Allow forcing of a parent commit, even if the parent is not a direct one.
This can be used to compress multiple changesets into one, for example
like

	git cvsexportcommit -P cvshead mybranch

without having to do so in git first.

Signed-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 14:10:01 -08:00
Junio C Hamano 4c55068683 bisect: it needs to be done in a working tree.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 14:03:27 -08:00
Johannes Schindelin 6d9ba67b0f Commands requiring a work tree must not run in GIT_DIR
This patch helps when you accidentally run something like git-clean
in the git directory instead of the work tree.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 14:02:16 -08:00
Stelian Pop 98d47d4ccf Add hg-to-git conversion utility.
hg-to-git.py  is able to convert a Mercurial repository into a git one,
and preserves the branches in the process (unlike tailor)

hg-to-git.py can probably be greatly improved (it's a rather crude
combination of shell and python) but it does already work quite well for
me. Features:
	- supports incremental conversion
	  (for keeping a git repo in sync with a hg one)
	- supports hg branches
	- converts hg tags

Signed-off-by: Stelian Pop <stelian@popies.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:52:45 -08:00
Aneesh Kumar K.V 3fb624521e blameview: Support browsable functionality to blameview.
Double clicking on the row execs a new blameview with commit hash
as argument.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:49:00 -08:00
Yasushi SHOJI 041794188f gitweb: Convert project name to UTF-8
If the repository directory name is in non-ascii, $project needs to be
converted from perl internal to utf-8 because it will be used as
title, page path, and snapshot filename.

use to_utf8() to do the conversion.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:49:00 -08:00
Shawn O. Pearce b2e69f6299 bash: Support git-bisect and its subcommands.
We now offer completion support for git-bisect's subcommands,
as well as ref name completion on the good/bad/reset subcommands.
This should make interacting with git-bisect slightly easier on
the fingers.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:49:00 -08:00
Shawn O. Pearce 1b71eb35dd bash: Support --add completion to git-config.
We've recently added --add as an argument to git-config, but I
missed putting it into the earlier round of git-config updates
within the bash completion.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:49:00 -08:00
Shawn O. Pearce e459415c9c bash: Hide git-resolve, its deprecated.
Don't offer resolve as a possible subcommand completion.  If you
read the top of the script, there is a big warning about how it
will go away soon in the near future.  People should not be using it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:49:00 -08:00
Shawn O. Pearce b26c87488f bash: Offer --prune completion for git-gc.
I'm lazy.  I don't want to type out --prune if bash can do it for
me with --<tab>.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:49:00 -08:00
Shawn O. Pearce 983591c31e bash: Hide diff-stages from completion.
Apparently nobody really makes use of git-diff-stages, as nobody
has complained that it is not supported by the git-diff frontend.
Since its likely this will go away in the future, we should not
offer it as a possible subcommand completion.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:49:00 -08:00
Shawn O. Pearce d8a9fea5ea bash: Support completion on git-cherry.
I just realized I did not support ref name completion for git-cherry.
This tool is just too useful to contributors who submit patches
upstream by email; completion support for it is very handy.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:49:00 -08:00
Shawn O. Pearce ea81fcc576 Show an example of deleting commits with git-rebase.
This particular use of git-rebase to remove a single commit or a
range of commits from the history of a branch recently came up on
the mailing list.  Documenting the example should help other users
arrive at the same solution on their own.

It also was not obvious to the newcomer that git-rebase is able to
accept any commit for --onto <newbase> and <upstream>.  We should
at least minimally document this, as much of the language in
git-rebase's manpage refers to 'branch' rather than 'committish'.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:48:59 -08:00
Andy Parkins 69057cf39f git-for-each-ref doesn't return "the bit after $GIT_DIR/refs"
The documentation for git-for-each-ref said that the refname variable
would return "the part after $GIT_DIR/refs/", which isn't true.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:48:59 -08:00
Junio C Hamano 133f081057 t9200: Work around HFS+ issues.
We at least know that the test as written has a problem in an
environment where "touch '$p'; ls | fgrep '$p'" fails, and have
a clear understand why it fails.

This tests if the filesystem has that particular issue we know "git
add" has a problem with, and skips the test in such an environment.
This way, we might catch issues "git add" might have in other environments.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05 13:38:02 -08:00
Junio C Hamano 798123af21 Rename get_ident() to fmt_ident() and make it available to outside
This makes the functionality of ident.c::get_ident() available to
other callers.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 17:50:14 -08:00
Gerrit Pape 11dbe9e880 git-archimport: initial import needs empty directory
git-archimport should better refuse to start an initial import if the
current directory is not empty.

(http://bugs.debian.org/400508)

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 17:05:16 -08:00
Junio C Hamano 756373da25 Revert "Allow branch.*.merge to talk about remote tracking branches."
This reverts commit 80c797764a.

Back when I committed this, it seemed to be a good idea.  People
who always use remote tracking branches can optionally use the
local name they happen to use to specify what to merge, which meant
that I did not have to teach them why we use the name at the remote
side every time they are confused.

But allowing it seems to break other people's scripts.  The real
solution is not to allow more ways to express the same thing, but
to educate people to use the right syntax.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 16:58:30 -08:00
Junio C Hamano d1f289c5aa Merge branch 'np/dreflog'
* np/dreflog:
  show-branch -g: default to the current branch.
  Let git-checkout always drop any detached head
  Enable HEAD@{...} and make it independent from the current branch
  scan reflogs independently from refs
  add reflog when moving HEAD to a new branch
  create_symref(): do not assume pathname from git_path() persists long enough
  add logref support to git-symbolic-ref
  move create_symref() past log_ref_write()
  add reflog entries for HEAD when detached
  enable separate reflog for HEAD
  lock_ref_sha1_basic(): remember the original name of a ref when resolving it
  make reflog filename independent from struct ref_lock
2007-02-04 16:54:47 -08:00
Robin Rosenberg 6e2e1cfb81 Why is it bad to rewind a branch that has already been pushed out?
Mention git-revert as an alternative to git-reset to revert changes.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 11:43:45 -08:00
Junio C Hamano 1f7d1a53fe git-clone --reference: saner handling of borrowed symrefs.
When using --reference to borrow objects from a neighbouring
repository while cloning, we copy the entire set of refs under
temporary "refs/reference-tmp/refs" space and set up the object
alternates.  However, a textual symref copied this way would not
point at the right place, and causes later steps to emit error
messages (which is harmless but still alarming).  This is most
visible when using a clone created with the separate-remote
layout as a reference, because such a repository would have
refs/remotes/origin/HEAD with 'ref: refs/remotes/origin/master'
as its contents.

Although we do not create symbolic-link based refs anymore, they
have the same problem because they are always supposed to be
relative to refs/ hierarchy (we dereference by hand, so it only
is good for HEAD and nothing else).

In either case, the solution is simply to remove them after
copying under refs/reference-tmp; if a symref points at a true
ref, that true ref itself is enough to ensure that objects
reachable from it do not needlessly get fetched.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 03:28:15 -08:00
Shawn O. Pearce ec80489132 bash: Support internal revlist options better.
format-patch/log/whatchanged all take --not and --all as options
to the internal revlist process.  So these should be supported
as possible completions.

gitk takes anything rev-list/log/whatchanged takes, so we should
use complete_revlist to handle its options.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 00:18:41 -08:00
Shawn O. Pearce b3391775e8 bash: Support unique completion when possible.
Because our use of -o nospace prevents bash from adding a trailing space
when a completion is unique and has been fully completed, we need to
perform this addition on our own.  This (large) change converts all
existing uses of compgen to our wrapper __gitcomp which attempts to
handle this by tacking a trailing space onto the end of each offered
option.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 00:18:41 -08:00
Shawn O. Pearce 78d4d6a281 bash: Support unique completion on git-config.
In many cases we know a completion will be unique, but we've disabled
bash's automatic space addition (-o nospace) so we need to do it
ourselves when necessary.

This change adds additional support for new configuration options
added in 1.5.0, as well as some extended completion support for
the color.* family of options.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 00:18:41 -08:00
Shawn O. Pearce a925c6f165 bash: Classify more commends out of completion.
Most of these commands are not ones you want to invoke from the
command line on a frequent basis, or have been renamed in 1.5.0 to
more friendly versions, but the old names are being left behind to
support existing scripts in the wild.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 00:18:41 -08:00
Shawn O. Pearce 72e5e989b8 bash: Add space after unique command name is completed.
Because we use the nospace option for our completion function for
the main 'git' wrapper bash won't automatically add a space after a
unique completion has been made by the user.  This has been pointed
out in the past by Linus Torvalds as an undesired behavior.  I agree.

We have to use the nospace option to ensure path completion for
a command such as `git show` works properly, but that breaks the
common case of getting the space for a unique completion.  So now we
set IFS=$'\n' (linefeed) and add a trailing space to every possible
completion option.  This causes bash to insert the space when the
completion is unique.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 00:18:41 -08:00
Shawn O. Pearce 8435b54848 bash: Complete long options to git-add.
The new --interactive mode of git-add can be very useful, so users
will probably want to have completion for it.

Likewise the new git-add--interactive executable is actually a
plumbing command.  Its invoked by `git add --interactive` and is
not intended to be invoked directly by the user.  Therefore we
should hide it from the list of available Git commands.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 00:18:41 -08:00
Shawn O. Pearce 2e3a430a9a bash: Classify cat-file and reflog as plumbing.
Now that git-show is capable of displaying any file content from any
revision and is the approved Porcelain-ish level method of doing so,
cat-file should no longer be classified as a user-level utility by
the bash completion package.

I'm also classifying the new git-reflog command as plumbing for the
time being as there are no subcommands which are really useful to
the end-user.  git-gc already invokes `git reflog expire --all`,
which makes it rather unnecessary for the user to invoke it directly.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 00:18:41 -08:00
Shawn O. Pearce 9f4cc6f76b bash: Remove short option completions for branch/checkout/diff.
The short options (-l, -f, -d) for git-branch are rather silly to
include in the completion generation as these options must be fully
typed out by the user and most users already know what the options
are anyway, so including them in the suggested completions does
not offer huge value.  (The same goes for git-checkout and git-diff.)

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04 00:18:41 -08:00
Junio C Hamano 632ac9fd12 show-branch -g: default to the current branch.
Now we have a separate reflog on HEAD, show-branch -g without an explicit
parameter defaults to the current branch, or HEAD when it is detached
from branches.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 23:34:22 -08:00
Nicolas Pitre dc9195ac78 Let git-checkout always drop any detached head
We used to refuse leaving a detached HEAD when it wasn't matching an
existing ref so not to lose any commit that might have been performed
while not on any branch (unless -f was provided).

But this protection was completely bogus since it was still possible
to move to HEAD^ while still remaining detached but losing the last
commit anyway if there was one.

Now that we have a proper reflog for HEAD it is best to simply remove
that bogus (and admitedly annoying) protection and simply display the
last HEAD position instead.  If one wants to recover a lost detached
state then it can be retrieved from the HEAD reflog.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 23:06:27 -08:00
Nicolas Pitre f2eba66d4d Enable HEAD@{...} and make it independent from the current branch
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 23:06:27 -08:00
Junio C Hamano d77ee72662 Merge branch 'master' into np/dreflog
This is to resolve conflicts early in preparation for possible
inclusion of "reflog on detached HEAD" series by Nico, as having
it in 1.5.0 would really help us remove confusion between
detached and attached states.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 23:05:34 -08:00
Shawn O. Pearce 8d0fc48f27 Default GIT_MERGE_VERBOSITY to 5 during tests.
Its really nice to be able to run a test with -v and automatically
see the "debugging" dump from merge-recursive, especially if we
are actually trying to debug merge-recursive.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 22:04:34 -08:00
Shawn O. Pearce 183d79724f Keep untracked files not involved in a merge.
My earlier fix (8371234e) to delete renamed tracked files from the
working directory also caused merge-recursive to delete untracked
files that were in the working directory.

The problem here is merge-recursive is deleting the working directory
file without regard for which branch it was associated with.  What we
really want to do during a merge is to only delete files that were
renamed by the branch we are merging into the current branch,
and that are still tracked by the current branch.  These files
definitely don't belong in the working directory anymore.

Anything else is either a merge conflict (already handled in other
parts of the code) or a file that is untracked by the current branch
and thus is not even participating in the merge.  Its this latter
class that must be left alone.

For this fix to work we are now assuming that the first non-base
argument passed to git-merge-recursive always corresponds to the
working directory.  This is already true for all in-tree callers
of merge-recursive.  This assumption is also supported by the
long time usage message of "<base> ... -- <head> <remote>", where
"<head>" is implied to be HEAD, which is generally assumed to be
the current tree-ish.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 22:04:28 -08:00
Pavel Roskin 3dff5379bf Assorted typo fixes
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 21:49:54 -08:00
Shawn O. Pearce 0f39087589 Cleanup subcommand documentation for git-remote.
Jakub Narebski pointed out the positional notation in git-remote's
documentation was very confusing, especially now that we have 3
supported subcommands.  Instead of referring to subcommands by
position, refer to them by name.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 21:49:49 -08:00
Pavel Roskin 9673a0b182 git-config --rename-section could rename wrong section
The "git-config --rename-section" implementation would match sections
that are substrings of the section name to be renamed.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 21:35:22 -08:00
Junio C Hamano 3b0f5e88ee combine-diff: special case --unified=0
Even when --unified=0 is given, the main loop to show the
combined textual diff needs to handle a line that is unchanged
but has lines that were deleted relative to a parent before it
(because that is where the lost lines hang).  However, such a
line should not be emitted in the final output.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 16:31:11 -08:00
Junio C Hamano a9d1836b10 Why is it bad to rewind a branch that has already been pushed out?
I was reading the tutorial and noticed that we say this:

    Also, don't use "git reset" on a publicly-visible branch that
    other developers pull from, as git will be confused by history
    that disappears in this way.

I do not think this is a good explanation.  For example, if we
do this:

(1) I build a series and push it out.

	---o---o---o---j

(2) Alice clones from me, and builds two commits on top of it.

	---o---o---o---j---a---a

(3) I rewind one and build a few, and push them out.

	---o---o---o...j
                    \
                     h---h---h---h

(4) Alice pulls from me again:

	---o---o---o---j---a---a---*
                    \             /
                     h---h---h---h

Contrary to the description, git will happily have Alice merge
between the two branches, and never gets confused.

Maybe I did not want to have 'j' because it was an incomplete
solution to some problem, and Alice may have fixed it up with
her changes, while I abandoned that approach I started with 'j',
and worked on something completely unrelated in the four 'h'
commits.  In such a case, the merge Alice would make would be
very sensible, and after she makes the merge if I pull from her,
the world will be perfect.  I started something with 'j' and
dropped the ball, Alice picked it up and perfected it while I
went on to work on something else with 'h'.  This would be a
perfect example of distributed parallel collaboration.  There is
nothing confused about it.

The case the rewinding becomes problematic is if the work done
in 'h' tries to solve the same problem as 'j' tried to solve in
a different way.  Then the merge forced on Alice would make her
pick between my previous attempt with her fixups (j+a) and my
second attempt (h).  If 'a' commits were to fix up what 'j'
started, presumably Alice already studied and knows enough about
the problem so she should be able to make an informed decision
to pick between what 'j+a' and 'h' do.

A lot worse case is if Alice's work is not at all related to
what 'j' wanted to do (she did not mean to pick up from where I
left off -- she just wanted to work on something different).
Then she would not be familiar enough with what 'j' and 'h'
tried to achieve, and I'd be forcing her to pick between the
two.  Of course if she can make the right decision, then again
that is a perfect example of distributed collaboration, but that
does not change the fact that I'd be forcing her to clean up my
mess.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 16:30:52 -08:00
Junio C Hamano 23913dc713 honor GIT_REFLOG_ACTION in git-commit
This allows git-cherry-pick and git-revert to properly identify
themselves in the resulting reflog entries.  Earlier they were
recorded as what git-commit has done.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 15:17:49 -08:00
Junio C Hamano 5f856dd47d fix reflog entries for "git-branch"
Even when -l is not given from the command line, the repository
may have the configuration variable core.logallrefupdates set,
or an old-timer might have done ": >.git/logs/refs/heads/new"
before running "git branch new".  In these cases, the code gave
an uninitialized msg[] from the stack to be written out as the
reflog message.

This also passes a different message when '-f' option is used.
Saying "git branch -f branch some-commit" is a moral equilvalent
of doing "git-reset some-commit" while on the branch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 12:54:49 -08:00
Nicolas Pitre eb8381c885 scan reflogs independently from refs
Currently, the search for all reflogs depends on the existence of
corresponding refs under the .git/refs/ directory.  Let's scan the
.git/logs/ directory directly instead.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 11:57:18 -08:00
Junio C Hamano 505739f6c0 core-tutorial: http reference link fix
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-02 23:17:34 -08:00
Junio C Hamano bf3478de97 Tutorial-2: Adjust git-status output to recent reality.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-02 22:55:07 -08:00
Junio C Hamano 953202a3fd Tutorial: fix asciidoc formatting of "git add" section.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-02 22:19:17 -08:00
Shawn O. Pearce 3cf8b462d2 Don't leak file descriptors from unavailable pack files.
If open_packed_git failed it may have been because the packfile
actually exists and is readable, but some sort of verification
did not pass.  In this case open_packed_git left pack_fd filled
in, as the file descriptor is valid.  We don't want to leak the
file descriptor, nor do we want to allow someone in the future
to use this packed_git.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-02 21:33:18 -08:00
Andy Parkins 0d18e41e00 doc: hooks.txt said post-commit default sends an email, it doesn't
The default post-commit hook is actually empty; it is the update hook
that sends an email.  This patch corrects hooks.txt to reflect that.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-02 21:18:59 -08:00
Eric Wong b6936205e7 Disallow invalid --pretty= abbreviations
--pretty=o is a valid abbreviation, --pretty=omfg is not

Noticed by: Nicolas Vilz
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-02 21:18:59 -08:00
Mike Coleman aacd404e77 Fix some documentation typos and grammar
Also suggest user manual mention .gitignore.

Signed-off-by: Michael Coleman <tutufan@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-01 22:45:04 -08:00