Git development
 help / color / mirror / Atom feed
* Re: [HELP] Adding git awareness to the darning patch management system.
From: Peter Williams @ 2011-12-01 23:32 UTC (permalink / raw)
  To: Jeff King; +Cc: git
In-Reply-To: <20111201062733.GB22141@sigill.intra.peff.net>

On 01/12/11 16:27, Jeff King wrote:
> On Thu, Dec 01, 2011 at 10:56:59AM +1000, Peter Williams wrote:
>
>>> I'm not exactly sure what this means.
>>
>> If you look at the screenshots at sourceforge (which were produced on
>> top of a Mercurial repo) you'll notice that file names in the left
>> most tree have letters in front of them and appear in different
>> foreground colours.  These letters are the same as those returned by
>> Mercurial's status command and, hence, give a Mercurial user an easy
>> to understand snapshot of the status of the files in the playground.
>> The colour coding is (relatively) arbitrary (and chosen by me) and is
>> intended to make it easier to detect the different file statuses.
>>
>> My main problem is that I can't find a git file status command (and
>> there are a lot of them to choose from) that gives a snapshot of the
>> statuses of all files in a directory (including those not tracked or
>> ignored).
>
> Thanks, that helps. You probably just want to use "git status
> --porcelain", which will show you the state of file modification with
> respect to the index and the prior commit, as well as any untracked
> files. See the "porcelain format" section in "git help status".
>
> Note that "git status" will not print files which are not modified. You
> may want to also run "git ls-files" to get the full listing of files,
> including unmodified ones.
>
>> A secondary problem is that, if I could cobble together statuses from
>> various commands, mapping git statuses to the Mercurial ones for
>> display would not be a good solution as they would not necessarily
>> make sense to a git user.  (It's fairly clear to me from my inability
>> to make sense of git's CLI that git users think differently to me, a
>> Mercurial user, and it's unlikely that I can, without help, make a
>> file tree display that makes sense to a git user.)
>
> I'm hoping that "git status --porcelain" will give you a fairly close
> mapping of the basic "what happened to this file" concept, based on what
> I see in the second screenshot you mentioned.
>
> The trickiest thing is the index, which represents an in-between state
> that is not usually exposed by other version control systems. If your
> tool does not make use of the index, then it probably makes sense to
> just consider a path as modified if it has modifications staged in the
> index or in the working tree, which maps to other VCS's idea of
> "modified" (because for them, marking something as to-be-committed and
> commiting it are part of the same step).

Yes, I think your right.  For most of my purposes, I think that it's 
irrelevant whether a change is staged or not and the choices that I 
offer allow the user to do what he thinks is right for a file with 
changes that are staged but uncommitted.  For me to automatically do 
something based on whether the file was staged for a commit would be a 
mistake as I would be reducing the user's options.

However, the distinction might be worth making in the file tree display 
to remind the user what's staged and what's not?

>
>>> For this, you probably want "git diff-files --name-only", which will
>>> show files with differences in the working tree. Keep in mind that git
>>> has an "index" or "staging area", which means that you have three states
>>> of content for a given path:
>>>
>>>    1. the state of the prior commit (i.e., HEAD)
>>>
>>>    2. the state that is marked to be committed when "git commit" is run
>>>       (i.e., the index)
>>>
>>>    3. the state in the working tree
>>
>> This is a prime example of the different mindset of the git user to
>> the hg user.
>
> You don't have to use those features, of course. It's just that
> something like "git status" is going to report on the differences
> between those states, so as a tool writer you need to know they are
> there (and as I said above, you are free to simplify if it fits into the
> mental model of your tool).
>
>>> You can compare the first two with "git diff-index", and the latter two
>>> with "git diff-files". You can also use "git status --porcelain" to get
>>> a machine-readable output that shows how the three states match up, with
>>> one line per file.
>>
>> This is an example of why I'm confused.  There are too many ways to
>> do (similar) things and it's hard to know which to use.
>
> Git is made of little building blocks. The original way to see the
> differences between the index and the working tree was via diff-files.
> But then people build bigger building blocks out of the smaller ones.
> "git status" is really just a shorthand for:
>
>    git diff-index HEAD&&
>    git diff-files&&
>    git ls-files -o
>
> and is in fact implemented using those building blocks (originally as a
> shell script, though these days it is written in C). So you can choose
> either and get the same information. Choosing a higher-level building
> block may save you some work, if the abstraction matches what you want.
> Otherwise, you can compose what you want from the lower levels.
>
> I know it sometimes leads to an overwhelming number of commands, and I'm
> not trying to excuse git's tendency to confuse people. I'm just hoping
> to unconfuse you in this particular situation.

As an aside, I found it easier to delve into git's innards to find out 
how to implement git binary patches than I did finding out how to do 
things from the CLI :-).

>
> In your case, I think "status" is the most convenient level of
> abstraction for you, because you are interesting in looking at
> differences to both the index and HEAD (i.e., the prior commit). But if
> you find as you implement that want more flexibility, you can switch to
> using the lower-level commands yourself.

I'll investigate this approach.  How easy is it to distinguish low level 
commands from high level commands?

>
>> Maybe an example of why I think the feature is useful might help.
>> Say that you start editing a file and then decide that you want to
>> put this change into a patch rather than committing it.  If you were
>> using quilt you would have to do this manually by any of a number or
>> ways such as:
>>
>> $<git diff command>  file>  temp.patch
>> $<git revert command>  file
>> $ quilt new one.patch
>> $ quilt add file
>> $ patch -p1 file<  temp.patch
>> $ rm temp.patch
>>
>> In darning, you just do:
>>
>> $ darn new one.patch
>> $ darn add --absorb file
>
> Sure. We have stgit and topgit, which do similar patch management things
> on top of git. I don't personally user either, though, so I don't have
> much to say on how they compare to darning, or whether it is worth
> looking at their implementations.

And there's MQ on top of hg.  I find the idea of doing "temporary" 
commits (which is what these tools are essentially doing) a little risky 
(e.g. what happens if you do a push with temporary commits in place). 
With MQ, I use its hook system to prevent this happening and I imagine 
git provides something similar.

Of course, these tools have the advantage that it's easier to promote a 
patch to a full blown commit than it is for quilt or darning in its 
current form (I'm thinking about how to do this).  At this stage, 
darning is targeted at the user who has to maintain a set of patches on 
top of a third party source tree without the need to eventually commit 
the changes themselves (i.e. distribution managers).

I've never used stgit or topgit but I have used both quilt and MQ a lot. 
  I find them both quite usable but each with their own set of 
advantages and disadvantages hence my attempt to make a tool as much 
like them as possible but with a smaller set of disadvantages.

>
>> The interface to the SCM to support this is two functions:
>>
>> 1: get_files_with_uncommitted_changes() which called with no
>> arguments returns a list of the paths of all files with uncommitted
>> changes or when given a list of file paths (the more common case)
>> returns the subset of that list which have uncommitted changes; and
>
> "status" will do this for you, modulo the simplification of the concept
> of the index, as we discussed above.
>
>> 2. copy_clean_version_to(filepath, target_path) which makes a copy of
>> the file as recorded in the prior commit and places it at the
>> target_path (usually where darning stores the "original" for
>> reference when creating diffs).
>
> You probably want:
>
>    git cat-file blob HEAD:filepath>target_path
>

I think I might do this in two stages.  First, just do the bit about 
adding files and pushing (as that is the most useful) and leave the file 
tree as a vanilla tree for the time being (as it looks like it may be 
more complicated).


Thanks for your help,
Peter

^ permalink raw reply

* Re: [PATCH] Add MYMETA.yml to perl/.gitignore
From: Jeff King @ 2011-12-01 22:35 UTC (permalink / raw)
  To: Sebastian Morr; +Cc: git
In-Reply-To: <20111201203114.GA12796@thinkpad>

On Thu, Dec 01, 2011 at 09:31:15PM +0100, Sebastian Morr wrote:

> This file is auto-generated in the process of building the Perl
> extension.
>
> [...]
> 
> I just built Git for the first time, issued "git status", and there
> was this untracked file. I guess you could call that an itch. This patch
> fixes that, however, I'm not sure whether this is a relevant issue.

Thanks, I wrote the same patch myself last week. I could swear I sent it
to the list, but it appears that I forgot.

The only thing I would add is the reason this is suddenly coming up now:
generating MYMETA.yml is done only by new-ish versions of
ExtUtils::MakeMaker (it started for me with perl 5.14, which just hit
debian unstable recently). The file just contains extra information
about the environment and arguments to the Makefile-building process,
and can be safely deleted.

-Peff

^ permalink raw reply

* Re: [PATCHv2 0/4] git-p4: small fixes to branches and labels; tests
From: Vitor Antunes @ 2011-12-01 21:59 UTC (permalink / raw)
  To: Pete Wyckoff; +Cc: git, Luke Diamand
In-Reply-To: <CAOpHH-UMdLpCPx1+D2dtQJs+=t1+0U2srKfTwBi-TEF4F7EDyw@mail.gmail.com>

On Dec 1, 2011 4:03 AM, "Pete Wyckoff" <pw@padd.com> wrote:
> I see your point.  P4 labels are the only way that they support
> tagging, apparently.  I'm okay with leaving label support in
> git-p4.  And it will be nice if Luke makes it behave a bit
> better.  But doing heroics to emulate cross-commit tags feels
> like a lot of work, and the wrong direction.

Agreed. Lets keep it simple.

-- 
Vitor Antunes

^ permalink raw reply

* Re: Proposal: create meaningful aliases for git reset's hard/soft/mixed
From: Phil Hord @ 2011-12-01 21:23 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: Junio C Hamano, git, Christian Couder
In-Reply-To: <CAGK7Mr5nQoubAw11KDj4WKwQnXrfgteKbMj2=AR-HhsGKi52wQ@mail.gmail.com>

On Wed, Nov 23, 2011 at 6:00 PM, Philippe Vaucher
<philippe.vaucher@gmail.com> wrote:
>> In any case, I think your proposal makes it even worse than the current
>> state, and you should aim higher.
>
> Why worse? I'd understand if you said it's doesn't improve it enough
> for it to be worth the change tho.

I think that's what "you should aim higher" means.

> Anyway, my proposal was to get a discussion going, and I'm all for
> aiming higher if there's a way. What do you propose instead? You
> seemed to imply we'd remove --soft and --merge, and make --keep as an
> option for --hard but named differently, something like
> --keep-changes. Maybe I didn't fully understand.

I think there are too many scripts dependent on these switches to
remove them.  But I love the direction you're going in.

Aim higher.

> Mathieu even suggested that it'd have the behavior of --keep by
> default, and that you have to add --force to get today's --hard
> behavior, which sounds like a good idea to me (avoid destructive
> behavior by default).

Think outside the "reset" command.  Like this:

>From the "most popular" comment on http://progit.org/2011/07/11/reset.html:
> I remember them as:
> --soft      -> git uncommit
> --mixed  -> git unadd
> --hard     -> git undo

I don't particular like these names, but conceptually they are helpful.

What other commands can we embellish or create to replace the overload
git-reset functionality?

How about:
  --soft: git checkout -B <commit>
  --mixed: git reset -- <paths>
  --hard:  git checkout --clean

Phil

^ permalink raw reply

* Re: Proposal: create meaningful aliases for git reset's hard/soft/mixed
From: Phil Hord @ 2011-12-01 21:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Philippe Vaucher, git, Christian Couder
In-Reply-To: <7vlir6brjw.fsf@alter.siamese.dyndns.org>

On Wed, Nov 23, 2011 at 1:51 PM, Junio C Hamano <gitster@pobox.com> wrote:
> "git reset --hard HEAD" is an unambiguously descriptive good name for the
> option. It is a "hard reset" like power cycling a machinery to discard
> anything in progress and get back to a clean slate. I do not see anything
> confusing with this mode nor its name.

As a git expert-user, I agree.

But, honestly, as a git new-user, I had a lot of trouble with this
command.  It is mysterious and powerful and new users do not
understand it.  Everyone learns "git reset --hard HEAD" as a single
command.  Only much later (if ever) do they learn about the other
git-reset options.  --hard is the only useful option for the new user,
so it seems superfluous.  HEAD is a foreign concept for the new-user
and makes little sense when this command is first memorized.  And at
the early stages of the git learning curve, that's what it is:
memorized.  _The spelling is what counts; the meaning is mysterious._
(For all its flaws, though, at least "git reset --hard HEAD" serves to
introduce the new-user to the concept of HEAD.)

So, as a git new-user, what I wanted was this:
  git clean-checkout [or "git checkout --clean"]

What I found instead was this:
  git reset --hard HEAD

What does this have to do with "checking out my files from the last
commit" or "discarding my local, uncommitted edits"?  To the new-user,
nothing at all.  reset?  Meaningless.  --hard?  Whatever.  HEAD?
Shrug.

In the end it doesn't even do what I wanted.  What I really wanted was this:
  git reset --hard HEAD && git clean -fd

I think the git-reset modes should be relegated to plumbing.  I can
see how 'git reset --mixed' is useful for resetting changes out of the
index, but reset is so mired in all sorts of extra mumbo-jumbo that
this usage becomes a forgotten detail for me.  I didn't even learn
that usage until later, where it makes loads of sense on its own:

     FTH: This means that git reset <paths> is the opposite of git add <paths>.

That is beautiful, clean and useful.  If that's all it did, it would be perfect.

Problems with git-reset--hard:
 * It has no safety nets (except the reflog, another concept foreign
to new-users)
 * It requires extra switches/arguments to be useful
 * Surprisingly (at first), it can move your branch, but it's not
spelled 'branch' or 'commit' or 'move'

That last one is particularly troubling in light of the description of
'git reset --hard':
     Resets the index and working tree. Any changes to tracked
     files in the working tree since <commit> are discarded.

Maybe we should add "and by the way, your currently checked-out branch
is moved to point to <commit>".

</rant>

Phil

^ permalink raw reply

* Re: Workflow Recommendation - Probably your 1000th
From: bradford @ 2011-12-01 20:46 UTC (permalink / raw)
  To: Stephen Bash; +Cc: git
In-Reply-To: <363b3901-eee6-4265-adae-267f4662a1f7@mail>

Thanks, Stephen.   I guess I'm looking for more input on the
advantages and disadvantages of using a QA and production branch vs
just doing everything out of master.

Trying to go through the following:
http://news.ycombinator.com/item?id=1617425
scottchacon.com/2011/08/31/github-flow.html

We have some weeks where we release very frequently and some weeks
where we release only once a week and have to do production fixes in
the meantime.  Sure other people have similar experiences.

On Thu, Dec 1, 2011 at 1:55 PM, Stephen Bash <bash@genarts.com> wrote:
> ----- Original Message -----
>> From: "bradford" <fingermark@gmail.com>
>> To: git@vger.kernel.org
>> Sent: Thursday, December 1, 2011 1:26:10 PM
>> Subject: Workflow Recommendation - Probably your 1000th
>>
>> You guys probably receive a ton of workflow related questions.  I'm
>> trying to convert from svn to git.  In order to complete, I would
>> like to be able to provide a workflow to our team.  We typically go
>> from dev -> qa -> production (Java and Rails projects).  The problem
>> is that sometimes QA can get backed up and we'll need to release
>> something to production while QA is doing their thing.  What is a
>> good workflow?  I would like to not use git-flow, because it's another
>> tool.
>
> Hey wow...  I read that Driessen's workflow post [1] a long time ago, but hadn't run into the git-flow tools until a few days ago.  Guess I was just oblivious...  Anyway, if it's any consolation, my company runs a model very much inspired by Driessen's post without using git-flow itself.
>
> [1] http://nvie.com/posts/a-successful-git-branching-model/
>
>> I've read suggestions to use environment branches (master,
>> staging, production).  I've also read not to do this and just use
>> master, tagging your production releases.  How well would our setup,
>> where things can get backed up, work with the latter?  Are there any
>> alternative suggestions?
>
> In our workflow we flip Driessen's model on its head.  master is the newest code, while we branch off maintenance branches just before each release.  We tag each release so it's easy to identify which versions in the field contain a given bug or fix (multiple minor versions come off a single maintenance branch).  Our QA guys follow the maintenance branches (they're relatively stable).  We recently had to do a hot-fix release which I think would be similar to your "release to production".  Basically we found the last commit on the maintenance branch that was well tested, created a new branch from there, did the hot fix, QA did some real fast testing (sounds like you'd skip this step), and we shipped that.  As always that hot-fix release gets tagged, so in the future we can still reference that particular build (and in this case the branch merged back into the maintenance branch -- we've had other situations where the branch was simply deleted after tagging).
>
> In the grand scheme of things our model isn't that different than Driessen's; we just name the branches differently.  Commits go on the oldest branch that's safe for them, and then everything merges to the newer branches.  Tags provide easy reference for where on a given branch a release came from.
>
> Hope that helps.
>
> Stephen

^ permalink raw reply

* [PATCH] Add MYMETA.yml to perl/.gitignore
From: Sebastian Morr @ 2011-12-01 20:31 UTC (permalink / raw)
  To: git

This file is auto-generated in the process of building the Perl
extension.

Signed-off-by: Sebastian Morr <sebastian@morr.cc>
---

Good day, fine Sirs and Madams,

I just built Git for the first time, issued "git status", and there
was this untracked file. I guess you could call that an itch. This patch
fixes that, however, I'm not sure whether this is a relevant issue.

Didn't know whom to Cc, as the perl directory doesn't seem to get much
attention lately.

Kind regards,
Sebastian

 perl/.gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/perl/.gitignore b/perl/.gitignore
index 98b2477..9235e73 100644
--- a/perl/.gitignore
+++ b/perl/.gitignore
@@ -1,5 +1,6 @@
 perl.mak
 perl.mak.old
+MYMETA.yml
 blib
 blibdirs
 pm_to_blib
-- 
1.7.8.rc4.dirty

^ permalink raw reply related

* Re: log: option "--follow" not the default for a single file?
From: Jeff King @ 2011-12-01 20:36 UTC (permalink / raw)
  To: Ralf Thielow; +Cc: git
In-Reply-To: <CAN0XMOKrCovkmmdqu2GjsDof0wehfbf5a0EQuPo0q7GQaJ=GRQ@mail.gmail.com>

On Thu, Dec 01, 2011 at 09:28:31PM +0100, Ralf Thielow wrote:

> > It's possible, but it is changing the meaning of "git log foo". With
> > the current code, even if "foo" is currently a file, it will match
> > "foo/bar" in a prior revision. Switching this to "--follow" will not.
> 
> Why does it actually match both things? I think that's
> maybe wrong.

Because that's what the path argument to "git log" is designed to do --
limit revision traversal based on pathspecs.

You can argue that the "--follow" semantics are more meaningful, but it
doesn't change the fact that it is a behavior change. We have to
consider not only backwards compatibility, but also the confusing-ness
of an inconsistent interface where:

  git log foo bar

will treat "foo" as a pathspec, but:

  git log foo

will treat it as a file.

> Also I can't use "git log" with another
> file/folder doesn't exists but in another revision. What actually
> exists is the file and that's imho the only thing that should match.

You can:

  git log -- existed-long-ago

As a syntax shortcut, you can drop the "--". However, there is some
ambiguity with revision arguments, so git allows path arguments without
a "--" only when they exist in the filesystem (_not_ in a particular
revision).

-Peff

^ permalink raw reply

* Re: log: option "--follow" not the default for a single file?
From: Ralf Thielow @ 2011-12-01 20:28 UTC (permalink / raw)
  To: Jeff King; +Cc: git
In-Reply-To: <20111201185230.GB2873@sigill.intra.peff.net>

> It's possible, but it is changing the meaning of "git log foo". With
> the current code, even if "foo" is currently a file, it will match
> "foo/bar" in a prior revision. Switching this to "--follow" will not.

Why does it actually match both things? I think that's
maybe wrong.
The folder was moved or delete so it doesn't exist in my
working directory. Also I can't use "git log" with another
file/folder doesn't exists but in another revision. What actually
exists is the file and that's imho the only thing that should match.

^ permalink raw reply

* Re: Copy branch into master
From: Neal Kreitzinger @ 2011-12-01 19:43 UTC (permalink / raw)
  To: git; +Cc: 'Andrew Eikum', git
In-Reply-To: <CB09450076EA444CA289CDCB995F16A4@bny.us.bosch.com>

On 11/28/2011 1:30 PM, Ron Eggler wrote:
>> Sorry, I have no idea how to use any of the GUI tools. Perhaps your
>> GUI tool has a mailing list where you can ask about merge conflict
>> resolution?
>
> No problem, I actually got it all figured out now, and got my branch
> smoothly merged back into master.
>
That is not what you originally asked for.  What you asked for was:
"Now I would like to copy exactly what I have in that branch back into 
my master to have an exact copy in my master of what got deployed with 
out any changes."  If you did a git-merge then what you did was combine 
master with DVT.  That most likely did not make master equal to DVT.  If 
you run the following git-diff the results will likely show they do not 
match:
$ git-diff --name-only sha1-of-master-after-DVT-merge 
sha1-of-DVT-before-merge-to-master

If you merge branch A into branch B it does not make branch B equal to 
branch A.  It makes branch B a combination of branch B and branch A 
(plus your merge conflict resolutions).  If you truly want to make 
master exactly match DVT then I recommend the following: (I'm assuming 
this is not a superproject containing submodules, and that you are using 
linux.  I am using git 1.7.1.)

(Return master to the state it was in when you asked the question)
(1) git checkout master
(2) git branch BKUP-master-DVT-merge (backup your current post-merge 
master to another branch)
(3) git reset --hard sha1-of-master-before-merge

(Return DVT to the state it was in when you asked the question)
(1) git checkout DVT
(2) git branch BKUP-DVT-B4-merge (backup current DVT if it has new work)
(3) git reset --hard sha1-of-DVT-before-merge

(Make master match DVT exactly)
(1) Use the "vendor branch code drop" method described in the git-rm 
manpage* (see note on permissions below).  (Use the git-archive command 
to create your tarball of DVT for this.)
(2) After "vendor branch code drop" is committed, git-diff --name-status 
master DVT (they should match, ie. no results that matter)
(3) git-tag the resulting commit to make it clear this is the version 
you deployed.

*Note: if you are tracking permissions in git (executable vs. 
non-executable bits) then you will need to accomodate and validate 
permissions in your git-archive and/or ensure permissions are set 
properly before committing your vendor branch code drop.  Otherwise, you 
will have permissions changes that do not exactly match DVT.

I recommend trying the above on a test copy of your repo to verify the 
results are really what you want.
(tar up your repo as root to retain permissions, and untar in test dir)
(repo path = /home/me/MY-REPO)
(1) pwd ( = /home/me)
(2) mkdir test
(3) su root
(4) pwd ( = /home/me)
(5) tar -cvzf MY-REPO.tar.gz MY-REPO/
(6) cd test
(7) mv ../MY-REPO.tar.gz .
(8) tar -xvzf MY-REPO.tar.gz
(test repo path = /home/me/test/MY-REPO)
(9) exit
(10) cd /home/me/test/MY-REPO
(11) try out what I said on test/MY-REPO and then decide if you want to 
do it on the real me/MY-REPO.

If you already have additional commits on master after your master-DVT 
merge then they are backed up in the BKUP-master-DVT-merge branch you 
made earlier.  These commits can then be interactively rebased on your 
remediated master.  (Be aware of any possible unique master-DVT merged 
code the new commits are dependent on.  If so, that code needs to be 
reincorporated instead of being unwittingly lost.)

All the above assumes that others have not already pulled your 
master-DVT merge and based their work on it.  If they have already 
pulled your new master and based work on it then it may be too late for 
this to be practical, or additional steps would be needed for others to 
properly remediate.  I'm assuming you have a known set of developers 
pulling from you.  It is possible for them to interactively rebase their 
new work onto your remediated master and take the merged-master out of 
their history.  (Be aware of any possible unique master-DVT merged code 
the new commits are dependent on.  If so, that code needs to be 
reincorporated instead of being unwittingly lost.)

Hope this helps.

v/r,
neal

^ permalink raw reply

* Re: Status after 'git clone --no-checkout' ?
From: Jeff King @ 2011-12-01 19:00 UTC (permalink / raw)
  To: norbert.nemec; +Cc: git
In-Reply-To: <jb59h0$p3e$1@dough.gmane.org>

On Wed, Nov 30, 2011 at 02:02:22PM +0100, norbert.nemec wrote:

> what exactly is the status after 'git clone --no-checkout'? Is there
> any straightforward way how one could end up in this state starting
> from a regularly checked out repository?

You have a HEAD which points to some actual commit, but no index or
working tree. I don't think there is a particular name for this state.

You can get something similar in an existing repo by deleting all of the
working tree files and removing .git/index.

> 'git checkout' without any further options serves to move from the
> aforementioned special state to a regular checked out state.
> Otherwise it never seems to do anything. Are there any other
> situations where 'git checkout' on its own would have any effect?

By itself, I don't think so. But you can use "git checkout -f" to
discard changes in the index and working tree, setting them back to the
state in HEAD.

At one point, some people used "git checkout" as a no-op, because it
would print the "ahead/behind" information with respect to the upstream.
These days, that information is part of "git status", so I suspect
people use that instead.

-Peff

^ permalink raw reply

* Re: [PATCH/RFC 1/2] pull: pass the --no-ff-only flag through to merge, not fetch
From: Samuel Bronson @ 2011-12-01 18:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vvcq0np35.fsf@alter.siamese.dyndns.org>

On Thu, Dec 1, 2011 at 1:06 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Samuel Bronson <naesten@gmail.com> writes:
>
>> Hmm, yes, I had noticed that it was a tristate (merge.ff clearly is),
>> and I guess --no-ff-only is a pretty ugly flag. I do have to ask,
>> though: why give --ff these new values? Wouldn't it make more sense to
>> reuse the values accepted by merge.ff; namely, 'true' (the implied
>> default), 'false', and 'only'?
>
> The 'true' and 'false' values to merge.ff are carry-over from the days
> when it was a boolean, _not_ a tristate. If we were to make the UI more
> rational by making it clear that this is not a boolean, it is a good time
> for us to aim a bit higher than merely repeating the mistakes we made in
> the past due to historical accident. In other words, we could add a
> synonym for the "default" mode in addition to "--ff=true" (and for the
> "always merge" mode in addition to "--ff=false") that makes it clear that
> the value is _not_ a boolean [*1*]. If we were to go the "--ff=<value>"
> route, we have to add support for other ways to spell boolean 'true'
> (e.g. 'yes', '1', and 'on') anyway, so it is not that much extra work to
> do so, I would think.

Sure, that makes sense. I was just a little worried that you might be
(accidentally) proposing that --ff use a different set of names than
merge.ff for a moment there...

>> Otherwise, this looks like a very nice way to implement what I want: I
>> guess it is probably a mistake that the existing (documented) flags do
>> not behave in this way?
>
> Yeah, right now if you say "merge --ff-only --no-ff", we say these are
> mutually exclusive (which is true), but if you think about the tristate
> nature of the 'ff' option and spell it differently in your head, i.e.
> "merge --ff=only --ff=never", it is reasonable to argue that we should
> apply the usual "last one overrides" rule and behave as if "merge --no-ff"
> were given (for the purpose of "last one overrides", the configured
> defaults can be treated as if they come very early on the command line).
> After all "merge --no-ff --ff" does seem to use the "last one overrides"
> rule.

Yes, I totally agree that it would make more sense that way; I
certainly tried that before I even began to look at any of the code.

> [Footnote]
>
> *1* Perhaps 'allowed' instead of 'normal' (which I wrote out of thin-air;
> I do not have any strong preference on the actual values) may be a better
> choice for such a "this is not a boolean" spelling for the default mode.

^ permalink raw reply

* Re: Workflow Recommendation - Probably your 1000th
From: Stephen Bash @ 2011-12-01 18:55 UTC (permalink / raw)
  To: bradford; +Cc: git
In-Reply-To: <CAEbKVFSXn3we7Btb3fN5DUW7BMub_ZrBeUwLUZrRFTmESoW97A@mail.gmail.com>

----- Original Message -----
> From: "bradford" <fingermark@gmail.com>
> To: git@vger.kernel.org
> Sent: Thursday, December 1, 2011 1:26:10 PM
> Subject: Workflow Recommendation - Probably your 1000th
> 
> You guys probably receive a ton of workflow related questions.  I'm
> trying to convert from svn to git.  In order to complete, I would
> like to be able to provide a workflow to our team.  We typically go 
> from dev -> qa -> production (Java and Rails projects).  The problem 
> is that sometimes QA can get backed up and we'll need to release
> something to production while QA is doing their thing.  What is a
> good workflow?  I would like to not use git-flow, because it's another
> tool.  

Hey wow...  I read that Driessen's workflow post [1] a long time ago, but hadn't run into the git-flow tools until a few days ago.  Guess I was just oblivious...  Anyway, if it's any consolation, my company runs a model very much inspired by Driessen's post without using git-flow itself.

[1] http://nvie.com/posts/a-successful-git-branching-model/

> I've read suggestions to use environment branches (master,
> staging, production).  I've also read not to do this and just use
> master, tagging your production releases.  How well would our setup,
> where things can get backed up, work with the latter?  Are there any
> alternative suggestions?

In our workflow we flip Driessen's model on its head.  master is the newest code, while we branch off maintenance branches just before each release.  We tag each release so it's easy to identify which versions in the field contain a given bug or fix (multiple minor versions come off a single maintenance branch).  Our QA guys follow the maintenance branches (they're relatively stable).  We recently had to do a hot-fix release which I think would be similar to your "release to production".  Basically we found the last commit on the maintenance branch that was well tested, created a new branch from there, did the hot fix, QA did some real fast testing (sounds like you'd skip this step), and we shipped that.  As always that hot-fix release gets tagged, so in the future we can still reference t
 hat particular build (and in this case the branch merged back into the maintenance branch -- we've had other situations where the branch was simply deleted after tagging).

In the grand scheme of things our model isn't that different than Driessen's; we just name the branches differently.  Commits go on the oldest branch that's safe for them, and then everything merges to the newer branches.  Tags provide easy reference for where on a given branch a release came from.

Hope that helps.

Stephen

^ permalink raw reply

* Re: log: option "--follow" not the default for a single file?
From: Jeff King @ 2011-12-01 18:52 UTC (permalink / raw)
  To: Ralf Thielow; +Cc: git
In-Reply-To: <CAN0XMOJGm1frOi7FEke7LfHCSBt2DRn_npkdKe0m3qZ=hQPNHw@mail.gmail.com>

On Wed, Nov 30, 2011 at 07:38:23PM +0100, Ralf Thielow wrote:

> >     pathspec. That may happen to match a single file in the current
> >     revision, but to git it is actually a prefix-limiting pattern, and
> Is it possible to detect the case of a single file in the current
> revisionand use "--follow" by default for exactly that?

It's possible, but it is changing the meaning of "git log foo". With
the current code, even if "foo" is currently a file, it will match
"foo/bar" in a prior revision. Switching this to "--follow" will not.

-Peff

^ permalink raw reply

* Re: git merge strange result
From: Jeff King @ 2011-12-01 18:50 UTC (permalink / raw)
  To: Catalin(ux) M. BOIE; +Cc: git
In-Reply-To: <alpine.LFD.2.02.1112011733070.32682@mail.embedromix.ro>

On Thu, Dec 01, 2011 at 05:36:00PM +0200, Catalin(ux) M. BOIE wrote:

> Below is a script that reproduce what a coleague of mine found.
> Seems that if in a branch we have a commit that is cherry-picked be
> master, than revert that commit in branch and merge branch in master,
> the revert is ignored. Is it normal?

Yes, it's by design. When doing a merge, we look at three points: the
tip of the current branch, the tip of the branch to be merged, and the
point at which history diverged (the "merge base"). We don't look
individually at the commits that happened between the merge base and
each tip.

The non-conflicting case for a 3-way merge is that one side makes some
change, but the other side does nothing. In this case, we include the
change in the merge result. But remember that we are only looking at
endpoints. So what the actual merge code sees is that one side's version
of a file is identical to the merge base's version, and that the other
side's version is now different.

In your case, one side makes the change, but then restores the original
state. So from the perspective of the merge code, no change happened at
all on that side.

-Peff

^ permalink raw reply

* Workflow Recommendation - Probably your 1000th
From: bradford @ 2011-12-01 18:26 UTC (permalink / raw)
  To: git

You guys probably receive a ton of workflow related questions.  I'm
trying to convert from svn to git.  In order to complete, I would like
to be able to provide a workflow to our team.  We typically go from
dev -> qa -> production (Java and Rails projects).  The problem is
that sometimes QA can get backed up and we'll need to release
something to production while QA is doing their thing.  What is a good
workflow?  I would like to not use git-flow, because it's another
tool.  I've read suggestions to use environment branches (master,
staging, production).  I've also read not to do this and just use
master, tagging your production releases.  How well would our setup,
where things can get backed up, work with the latter?  Are there any
alternative suggestions?

Thanks,
Bradford

^ permalink raw reply

* Re: [PATCH] compat/getpass.c: Fix a sparse "symbol not declared" warning
From: Jeff King @ 2011-12-01 18:19 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list
In-Reply-To: <4ED69803.6070508@ramsay1.demon.co.uk>

On Wed, Nov 30, 2011 at 08:54:27PM +0000, Ramsay Jones wrote:

> When you next re-roll your most recent credentials/getpass series, could
> you please squash this patch in. (This patch was against pu @ 1cc922af,
> but I guess you need to apply a similar patch to commit 8eca119c "stub out
> getpass_echo function", 27-11-2011 instead)

Sure, makes sense. Thanks.

-Peff

^ permalink raw reply

* [PATCH] compat/getpass.c: Fix a sparse "symbol not declared" warning
From: Ramsay Jones @ 2011-11-30 20:54 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, GIT Mailing-list


In particular, sparse complains as follows:

        SP compat/getpass.c
    compat/getpass.c:5:6: warning: symbol 'getpass_echo' was not \
        declared. Should it be static?

In order to suppress the warning, we include the getpass.h header
file which contains an appropriate extern declaration.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Hi Jeff,

When you next re-roll your most recent credentials/getpass series, could
you please squash this patch in. (This patch was against pu @ 1cc922af,
but I guess you need to apply a similar patch to commit 8eca119c "stub out
getpass_echo function", 27-11-2011 instead)

Thanks!

ATB,
Ramsay Jones

 compat/getpass.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/compat/getpass.c b/compat/getpass.c
index b5bd1dd..a145d27 100644
--- a/compat/getpass.c
+++ b/compat/getpass.c
@@ -1,4 +1,5 @@
 #include "../git-compat-util.h"
+#include "getpass.h"
 
 #ifdef HAVE_DEV_TTY
 
-- 
1.7.7

^ permalink raw reply related

* [PATCH] Makefile: Add missing "sparse object" to gettext target-specific rule
From: Ramsay Jones @ 2011-11-30 20:43 UTC (permalink / raw)
  To: avarab; +Cc: Junio C Hamano, GIT Mailing-list


In particular, we add gettext.sp to the target-specific rule which
adds the GIT_LOCALE_PATH setting to EXTRA_CPPFLAGS, otherwise sparse
complains thus:

        SP gettext.c
    gettext.c:125:25: error: undefined identifier 'GIT_LOCALE_PATH'

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Hi Avar,

If you are going to re-roll your latest i18n patch (commit 6c856c48,
"i18n: add infrastructure for translating Git with gettext", 18-11-2011),
could you please squash this patch into it.

Thanks!

ATB,
Ramsay Jones

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index ac8c76d..f926b5f 100644
--- a/Makefile
+++ b/Makefile
@@ -2129,7 +2129,7 @@ config.sp config.s config.o: EXTRA_CPPFLAGS = \
 attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
 	-DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
 
-gettext.s gettext.o: EXTRA_CPPFLAGS = \
+gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
 	-DGIT_LOCALE_PATH='"$(localedir_SQ)"'
 
 http.sp http.s http.o: EXTRA_CPPFLAGS = \
-- 
1.7.7

^ permalink raw reply related

* Re: [PATCH/RFC 1/2] pull: pass the --no-ff-only flag through to merge, not fetch
From: Junio C Hamano @ 2011-12-01 18:06 UTC (permalink / raw)
  To: Samuel Bronson; +Cc: git
In-Reply-To: <CAJYzjmep7sKxiSNhMzAX2DRYJhANDQkPL5pX4HOZ9CssJxcWbw@mail.gmail.com>

Samuel Bronson <naesten@gmail.com> writes:

> Hmm, yes, I had noticed that it was a tristate (merge.ff clearly is),
> and I guess --no-ff-only is a pretty ugly flag. I do have to ask,
> though: why give --ff these new values? Wouldn't it make more sense to
> reuse the values accepted by merge.ff; namely, 'true' (the implied
> default), 'false', and 'only'?

The 'true' and 'false' values to merge.ff are carry-over from the days
when it was a boolean, _not_ a tristate. If we were to make the UI more
rational by making it clear that this is not a boolean, it is a good time
for us to aim a bit higher than merely repeating the mistakes we made in
the past due to historical accident. In other words, we could add a
synonym for the "default" mode in addition to "--ff=true" (and for the
"always merge" mode in addition to "--ff=false") that makes it clear that
the value is _not_ a boolean [*1*]. If we were to go the "--ff=<value>"
route, we have to add support for other ways to spell boolean 'true'
(e.g. 'yes', '1', and 'on') anyway, so it is not that much extra work to
do so, I would think.

> Otherwise, this looks like a very nice way to implement what I want: I
> guess it is probably a mistake that the existing (documented) flags do
> not behave in this way?

Yeah, right now if you say "merge --ff-only --no-ff", we say these are
mutually exclusive (which is true), but if you think about the tristate
nature of the 'ff' option and spell it differently in your head, i.e.
"merge --ff=only --ff=never", it is reasonable to argue that we should
apply the usual "last one overrides" rule and behave as if "merge --no-ff"
were given (for the purpose of "last one overrides", the configured
defaults can be treated as if they come very early on the command line).
After all "merge --no-ff --ff" does seem to use the "last one overrides"
rule.

[Footnote]

*1* Perhaps 'allowed' instead of 'normal' (which I wrote out of thin-air;
I do not have any strong preference on the actual values) may be a better
choice for such a "this is not a boolean" spelling for the default mode.

^ permalink raw reply

* Re: [PATCH/RFC 1/2] pull: pass the --no-ff-only flag through to merge, not fetch
From: Samuel Bronson @ 2011-12-01 17:18 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vborsq45x.fsf@alter.siamese.dyndns.org>

On Wed, Nov 30, 2011 at 11:58 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Samuel Bronson <naesten@gmail.com> writes:
>
>> Without this, pull becomes unusable for merging branches when the config
>> option `merge.ff` is set to `only`.
>>
>> Signed-off-by: Samuel Bronson <naesten@gmail.com>
>
> I wonder why you need this. We have "git config --unset merge.ff" after
> all. From purely mechanstic point of view, being able to temporarily
> defeat a configuration variable makes perfect sense, but from the point of
> view of workflow, I am not sure if it is a good thing to even allow it in
> the first place in this particular case.
>
> Setting merge.ff to 'only' means you are following along other people's
> work and making nothing new on your own in this particular repository, no?
> Hence you won't be asking the upstream to pull from this repository, which
> in turn means that even if you made a merge by temporarily defeating the
> configuration setting with this patch, your future pulls will no longer
> fast forward, until somehow the upstream gets hold of your merge commit.

Actually, I wanted to set merge.ff to only avoid *accidentally*
merging origin/master onto my local master, when I would likely to
prefer to either rebase my work onto it, or retroactively put my work
in a branch and merge that *into* the real master branch; I would then
override only when I explicitly did want a merge.

(I actually have commit access to the repository in question, but wish
to avoid making others' commits to master look as if they were on side
branches.)

> By the way (this is a digression), I also have to say --no-ff-only is too
> *ugly* as a UI element, even though I know "git merge" already allows it
> by accident.
>
> "ff" is a tristate. By default, fast-forward is done when appropriate, and
> people can _refuse_ to fast-forward and force Git to create an extra merge
> commit. Or if you are strictly following along, you can say you _require_
> fast-forward and reject anything else. So it may make the UI saner if we
> updated the UI to allow users to say:
>
>        --ff=normal     the default
>        --ff=never      same as --no-ff that forces an extra merge commit
>        --ff=required   same as --ff-only
>
> while keeping the current --ff-only and --no-ff as backward compatibility
> wart.

Hmm, yes, I had noticed that it was a tristate (merge.ff clearly is),
and I guess --no-ff-only is a pretty ugly flag. I do have to ask,
though: why give --ff these new values? Wouldn't it make more sense to
reuse the values accepted by merge.ff; namely, 'true' (the implied
default), 'false', and 'only'?

Otherwise, this looks like a very nice way to implement what I want: I
guess it is probably a mistake that the existing (documented) flags do
not behave in this way?

^ permalink raw reply

* git merge strange result
From: Catalin(ux) M. BOIE @ 2011-12-01 15:36 UTC (permalink / raw)
  To: git

Hello!

Below is a script that reproduce what a coleague of mine found.
Seems that if in a branch we have a commit that is cherry-picked be 
master, than revert that commit in branch and merge branch in master, the 
revert is ignored. Is it normal?

Thank you very much!

#!/bin/bash

set -e

rm -rf buba1
mkdir buba1
cd buba1

git init
echo -e "aaa\nbbb\nccc" > file1
git add file1
git commit -m "c1"

echo "Create branch b1..."
git branch b1
echo

echo "Create a bad fix..."
sed --in-place -e 's/bbb/bad line/' file1
git add file1
git commit -m "bad commit"
cat file1
echo

echo "Cherry pick on b1..."
git checkout b1
git cherry-pick -x master
echo

echo "Reverting on b1"
git revert --no-edit b1
echo

echo "Switch to master"
git checkout master
echo

echo "merge-base is `git merge-base --all master b1 | git name-rev --stdin`"
echo

echo "diff between master and b1..."
git diff master b1
echo

echo "Merge b1 in master"
git merge --verbose --log b1

if [ "`grep bad file1`" = "" ]; then
 	echo "good!"
else
 	echo "bad!"
fi
# it should prind "good"

--
Catalin(ux) M. BOIE
http://kernel.embedromix.ro/

^ permalink raw reply

* Re: mini-wierdness with "git am"
From: Andrew Wong @ 2011-12-01 15:38 UTC (permalink / raw)
  To: Aghiles; +Cc: git list
In-Reply-To: <CAKCZoVb5-JfzTXK9pUoem_0oQHrSLkrxQZUOZGTX3GGgebPGwA@mail.gmail.com>

On 11/30/2011 06:12 PM, Aghiles wrote:
> At this point, my repository is back to ORIG_HEAD!
> Meaning that it reverted my preivous "git reset --hard HEAD~1".
>   

This behavior seems to have been fixed in v1.7.3.5 and later. The new
behavior will skip the reverting, and only perform the clean up.

http://article.gmane.org/gmane.comp.version-control.git/164045

^ permalink raw reply

* Re: Anyone have a commit hook for forbidding old branches from being merged in?
From: Thomas Rast @ 2011-12-01 15:50 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Git Mailing List
In-Reply-To: <CACBZZX4LyTaz=fU1vvgpeL904QFjJULCMVSP0uutcuxZT+-vWQ@mail.gmail.com>

Ævar Arnfjörð Bjarmason wrote:
> 
> So before I write a hook to do this, is there anything that implements
> a hook that:
> 
>  * Checks if you're pushing a merge commit
>  * If so, is that merge based off and old version of $MAINBRANCH

I think it suffices to check whether any boundary commit in the
updated range is older than what you allow, e.g.

while read old new rev; do
    # omitted: check it's an update, i.e., neither old nor new is 0..0
    git rev-list --boundary $old..$new |
    sed -n 's/^-//p' |
    xargs git rev-list --no-walk --before='cutoff limit' >bad
    test -s bad || exit 1
done

(Not tested much; in particular I'm not sure you can get away without
limiting the number of args to rev-list to 1.  A simple test seems to
indicate so, however.)

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

^ permalink raw reply

* Re: [PATCH v2 5/5] bulk-checkin: replace fast-import based implementation
From: Junio C Hamano @ 2011-12-01 15:46 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git
In-Reply-To: <CACsJy8D5BqqkXCa7kczcNBxjt=G2d2ZXUToncR2pBGRuZ3gPKg@mail.gmail.com>

Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:

> On Thu, Dec 1, 2011 at 7:27 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> @@ -458,11 +459,15 @@ int cmd_add(int argc, const char **argv, const char *prefix)
>>                free(seen);
>>        }
>>
>> +       plug_bulk_checkin();
>> +
>>        exit_status |= add_files_to_cache(prefix, pathspec, flags);
>>
>>        if (add_new_files)
>>                exit_status |= add_files(&dir, flags);
>>
>> +       unplug_bulk_checkin();
>> +
>>  finish:
>>        if (active_cache_changed) {
>>                if (write_cache(newfd, active_cache, active_nr) ||
>
> Also do the same for git-commit, except as-is commit case, for
> updating large files?
>
> update-index should also learn about this,...

I didn't do any of the above in this series and that was on purpose.

Getting plug/unplug (and all the machinery that they are related to) to do
the right thing when they are called is far more important at this stage
than figuring out when it is appropriate to plug and unplug in various
random programs, it is sufficient to have one canonical and simplest
callsite pair as an example in the primary interface to add new objects
(i.e. "git add") for that purpose, and it is not too cumbersome for early
adopters to remember using "git add" when adding oddball large blobs
instead of using "commit -a".

In short, I wanted to keep the patch to the minimum to avoid distracting
capable reviewers (which is in short supply these days).

I wouldn't stop you or anybody from preparing a patch series that adds
plug/unplug pairs before the machinery is perfected, so that such an
effort can expose a corner case where the machinery and the API presented
in this series is inadequate and can use improvements. Once the machinery
gets perfected, submit such a patch series to add users that are well
tested.

Thanks.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox