* Re: libxdiff and patience diff
From: Pierre Habouzit @ 2008-11-04 16:15 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: davidel, Git ML
In-Reply-To: <alpine.DEB.1.00.0811041650510.24407@pacific.mpi-cbg.de>
[-- Attachment #1: Type: text/plain, Size: 2571 bytes --]
On Tue, Nov 04, 2008 at 03:57:44PM +0000, Johannes Schindelin wrote:
> Hi,
>
> On Tue, 4 Nov 2008, Pierre Habouzit wrote:
>
> > The nasty thing about the patience diff is that it still needs the usual
> > diff algorithm once it has split the file into chunks separated by
> > "unique lines".
>
> Actually, it should try to apply patience diff again in those chunks,
> separately.
yes it's what I do, but this has a fixed point as soon as you don't find
unique lines between the new found ones, or that that space is "empty".
E.g. you could have the two following hunks:
File A File B
1 2
2 1
1 2
2 1
1 2
2
1
The simple leading/trailing reduction will do nothing, and you don't
have any shared unique lines, on that you must apply the usual diff
algorithm.
> > So you cannot make really independant stuff. What I could do is put most
> > of the xpatience diff into xpatience.c but it would still have to use
> > some functions from xdiffi.c that are currently private, so it messes
> > somehow the files more than it's worth IMHO.
>
> I think it is better that you use the stuff from xdiffi.c through a well
> defined interface, i.e. _not_ mess up the code by mingling it together
> with the code in xdiffi.c. The code is hard enough to read already.
Hmmm. I'll see to that later, once I have something that works.
> Oh, BTW, "ha" is a hash of the lines which is used to make the line
> matching more performant. You will see a lot of "ha" comparisons before
> actually calling xdl_recmatch() for that reason. Incidentally, this is
> also the hash that I'd use for the hash multi-set I was referring to.
Yeah, that's what I assumed it would be.
> Oh, and I am not sure that it is worth your time trying to get it to run
> with the linear list, since you cannot reuse that code afterwards, and
> have to spend the same amount of time to redo it with the hash set.
Having the linear list (actually an array) work would show me I hook at
the proper place. Replacing a data structure doesn't makes me afraid
because I've split the functions properly.
> I am awfully short on time, so it will take some days until I can review
> what you have already, unfortunately.
NP, it was just in case, because I'm horribly stuck with that code right
now ;)
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: libxdiff and patience diff
From: Johannes Schindelin @ 2008-11-04 15:57 UTC (permalink / raw)
To: Pierre Habouzit; +Cc: davidel, Git ML
In-Reply-To: <20081104152351.GA21842@artemis.corp>
Hi,
On Tue, 4 Nov 2008, Pierre Habouzit wrote:
> The nasty thing about the patience diff is that it still needs the usual
> diff algorithm once it has split the file into chunks separated by
> "unique lines".
Actually, it should try to apply patience diff again in those chunks,
separately.
> So you cannot make really independant stuff. What I could do is put most
> of the xpatience diff into xpatience.c but it would still have to use
> some functions from xdiffi.c that are currently private, so it messes
> somehow the files more than it's worth IMHO.
I think it is better that you use the stuff from xdiffi.c through a well
defined interface, i.e. _not_ mess up the code by mingling it together
with the code in xdiffi.c. The code is hard enough to read already.
Oh, BTW, "ha" is a hash of the lines which is used to make the line
matching more performant. You will see a lot of "ha" comparisons before
actually calling xdl_recmatch() for that reason. Incidentally, this is
also the hash that I'd use for the hash multi-set I was referring to.
Oh, and I am not sure that it is worth your time trying to get it to run
with the linear list, since you cannot reuse that code afterwards, and
have to spend the same amount of time to redo it with the hash set.
I am awfully short on time, so it will take some days until I can review
what you have already, unfortunately.
Ciao,
Dscho
^ permalink raw reply
* Re: libxdiff and patience diff
From: Pierre Habouzit @ 2008-11-04 15:23 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: davidel, Git ML
In-Reply-To: <alpine.DEB.1.00.0811041447170.24407@pacific.mpi-cbg.de>
[-- Attachment #1.1: Type: text/plain, Size: 5442 bytes --]
On Tue, Nov 04, 2008 at 02:34:37PM +0000, Johannes Schindelin wrote:
> Hi,
>
> On Tue, 4 Nov 2008, Pierre Habouzit wrote:
>
> > On Tue, Nov 04, 2008 at 05:39:48AM +0000, Johannes Schindelin wrote:
> >
> > > On Tue, 4 Nov 2008, Pierre Habouzit wrote:
> > >
> > > > I've been working tonight, trying to make libxdiff support the
> > > > patience diff algorithm, but I've totally failed, because I
> > > > _thought_ I understood what xdl_split was doing, but it appears I
> > > > don't.
> > >
> > > I thought about it, too, at the GitTogether, although I want to finish
> > > my jGit diff first.
> > >
> > > The main idea I had about patience diff is that you can reuse a lot of
> > > functions in libxdiff.
> > >
> > > But the requirement of taking just unique lines/hashes into account,
> > > and _after_ splitting up, _again_ determine uniqueness _just_ in the
> > > between-hunk part made me think that it may be wiser to have a
> > > separate function for the patience diff stuff.
> > >
> > > Basically, you would start to have libxdiff split the lines and hash
> > > them as normal, but then determine the unique hashes (I'd start with
> > > the smaller text, just to have a better chance to end up with unique
> > > hashes).
> > >
> > > Once they are determined, you can search for those exact lines (hash
> > > first) in the post-document.
> >
> > Actually my current implementation just puts all the hashes into an
> > array, sorts them by hash (which is O(n log(n)) with the position from
> > left or right file it's in, ordered by increasing right position. (and
> > the struct is filled with the left pos to -1 if the right pos is set,
> > and vice versa).
>
> Yeah, that would be much more efficient using a hash-multiset. Still
> linear size (albeit twice as much). And you can already discard double
> entries early (although you have to keep one pointer in the hash-multiset
> to prevent other identical lines from being misdetected as "unique").
Probably, I just wanted something to work first, and then optimize it
using the proper structure.
> I am not sure that you really end up with patience diff that way. I
> _think_ that you need to determine the longest sequence of unique lines
> which has the property of being ordered in both texts first, and only
> _then_ recurse into the not-yet-handled lines.
I must have been using really bad english because it's what I do ;)
> > > Once that is done, you'd have to find the longest common subsequence,
> > > which you could do using the existing infrastructure, but that would
> > > require more work (as we already know the lines are unique).
> >
> > Patience diff gives you the algorithm to do that, it's pretty simple,
> > and is more efficient than the current infrastructure (in time, I don't
> > know for space though).
>
> Actually, IIRC it is pretty easy to see that the time complexity is linear
> (and therefore, the space complexity, too).
Well the space complexity of the patience diff would be linear too for
me, though I'm afraid that the current state of my implementation has a
big factor front ;)
> > In fact when I look at the records I have in xdiffi.c I had the
> > impression they were already somehow collapsed, which makes it a too
> > late point to apply the patience diff ...
>
> AFAICS xdiffi.c contains the classical diff algorithm (incidentally, I the
> inventor of that algorithm is about 50 meters away from me at this very
> moment). It should not have anything of interest to you, except for the
> fall-back case.
>
> So I think that you should add a new file xpatience.c.
>
> In that, I'd implement that hash multi-set, and use a prepared xdfenv_t to
> fill it (smaller file first, then you can traverse the other file,
> checking for uniqueness in that file and for a match in the other file at
> the same time).
>
> You _could_ build the longest list of ordered pairs at the same time, too,
> but that may make the code a bit too complex.
Well, technically, if I'm correct, xdiffi.c already has a pruned list of
hashed (I suppose ->ha is a hash value somehow ?) lines (pruned from
lines without a match left or right), and I was massaging that. Though
it absolutely fails so I fear I didn't understand what the ha stuff is
for real.
Attached is my current work (YES it is horrible, it's WIP), probably
most of it can be put in an xpatience.c file, but still, I absolutely
don't understand what gets wrong. On the simple example from
glandium.org it _looks_ like it catches the "unique" include line fine,
but somehow not.
The nasty thing about the patience diff is that it still needs the usual
diff algorithm once it has split the file into chunks separated by
"unique lines". So you cannot make really independant stuff. What I
could do is put most of the xpatience diff into xpatience.c but it would
still have to use some functions from xdiffi.c that are currently
private, so it messes somehow the files more than it's worth IMHO.
Anyways, I'm waiting for a client to finally setup his network for the
test I'm supposed to do right now, I'll try to have a closer look
tonight...
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #1.2: wip.patch --]
[-- Type: text/plain, Size: 8642 bytes --]
diff --git a/diff.c b/diff.c
index f644947..0901cdc 100644
--- a/diff.c
+++ b/diff.c
@@ -2447,6 +2447,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
options->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE;
else if (!strcmp(arg, "--ignore-space-at-eol"))
options->xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOL;
+ else if (!strcmp(arg, "--patience"))
+ options->xdl_opts |= XDF_USE_PATIENCE;
/* flags options */
else if (!strcmp(arg, "--binary")) {
diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h
index 84fff58..bba915c 100644
--- a/xdiff/xdiff.h
+++ b/xdiff/xdiff.h
@@ -32,6 +32,7 @@ extern "C" {
#define XDF_IGNORE_WHITESPACE (1 << 2)
#define XDF_IGNORE_WHITESPACE_CHANGE (1 << 3)
#define XDF_IGNORE_WHITESPACE_AT_EOL (1 << 4)
+#define XDF_USE_PATIENCE (1 << 5)
#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE | XDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL)
#define XDL_PATCH_NORMAL '-'
diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c
index 9d0324a..1a5b13a 100644
--- a/xdiff/xdiffi.c
+++ b/xdiff/xdiffi.c
@@ -37,8 +37,235 @@ typedef struct s_xdpsplit {
int min_lo, min_hi;
} xdpsplit_t;
+typedef struct s_xduniqmatch {
+ struct s_xduniqmatch *next;
+ long i1, i2, len;
+} xduniqmatch_t;
+
+typedef struct s_xdp_ha {
+ struct s_xdp_ha *up, *down;
+ struct s_xdp_ha *left;
+ long ha;
+ long off1;
+ long off2;
+} xdp_ha_t;
+
+
+static xduniqmatch_t *xdl_uniq_match_alloc(long i1, long i2, long len)
+{
+ xduniqmatch_t *match = xdl_malloc(sizeof(xduniqmatch_t));
+ if (match) {
+ match->next = NULL;
+ match->i1 = i1;
+ match->i2 = i2;
+ match->len = len;
+ }
+ return match;
+}
+
+static xduniqmatch_t *xdl_uniq_popfree(xduniqmatch_t *lst)
+{
+ xduniqmatch_t *next = lst->next;
+ xdl_free(lst);
+ return next;
+}
+
+static int xdp_ha_cmp_by_ha(const void *a1, const void *a2)
+{
+ const xdp_ha_t *ha1 = a1;
+ const xdp_ha_t *ha2 = a2;
+ if (ha1->ha == ha2->ha) {
+ return ha1->off2 - ha2->off2;
+ }
+ return ha1->ha - ha2->ha;
+}
+
+static int xdp_ha_cmp_by_off2(const void *a1, const void *a2)
+{
+ const xdp_ha_t *ha1 = a1;
+ const xdp_ha_t *ha2 = a2;
+ return ha2->off2 - ha1->off2;
+}
+
+static int patience_bisect_stack(xdp_ha_t **stacks, long len, long off1)
+{
+ long l = 0, r = len;
+
+ while (l < r) {
+ long i = (r + l) / 2;
+
+ if (off1 < stacks[i]->off1) {
+ l = i + 1;
+ } else {
+ r = i;
+ }
+ }
+ return l;
+}
+
+static int xdl_patience_split_aux(xduniqmatch_t *lcs, xdp_ha_t *ha)
+{
+ xduniqmatch_t *tmp;
+
+ while (ha) {
+ tmp = xdl_uniq_match_alloc(ha->off1, ha->off2, 1);
+ if (!tmp)
+ return -1;
+ tmp->next = lcs->next;
+ lcs->next = tmp;
+ lcs = tmp;
+
+ while ((ha = ha->down ? ha->down : ha->left)) {
+ if (lcs->i1 + lcs->len + 1 == ha->off1 && lcs->i2 + lcs->len + 1 == ha->off2) {
+ lcs->len++;
+ continue;
+ }
+ break;
+ }
+ }
+ return 0;
+}
+
+static int xdl_patience_split(unsigned long const *ha1, unsigned long const *ha2,
+ xduniqmatch_t *begin, xduniqmatch_t *end)
+{
+ xdp_ha_t *recs;
+ long off1 = begin->i1 + begin->len, lim1 = end->i1;
+ long off2 = begin->i2 + begin->len, lim2 = end->i2;
+ long len, i, j, uniq;
+
+ len = lim1 - off1 + lim2 - off2;
+ recs = (xdp_ha_t *)xdl_malloc(sizeof(xdp_ha_t) * len);
+ if (recs == NULL)
+ return -1;
+
+ for (i = 0, j = off1; j < lim1 - off1; j++, i++) {
+ recs[i].ha = ha1[j];
+ recs[i].off1 = j;
+ recs[i].off2 = -1;
+ recs[i].up = recs[i].down = recs[i].left = NULL;
+ }
+ for (j = off2; j < lim2; j++, i++) {
+ recs[i].ha = ha2[j];
+ recs[i].off1 = -1;
+ recs[i].off2 = j;
+ recs[i].up = recs[i].down = recs[i].left = NULL;
+ }
+
+ qsort(recs, len, sizeof(xdp_ha_t), xdp_ha_cmp_by_ha);
+
+ uniq = 0;
+ for (i = 0; i < len - 1; ) {
+ long ha = recs[i].ha;
+
+ if (ha != recs[i + 1].ha) {
+ i++;
+ continue;
+ }
+
+ if (i < len - 2 && ha == recs[i + 2].ha) {
+ i += 3;
+ while (i < len - 1 && recs[i].ha == ha && i < len - 1) {
+ i++;
+ }
+ continue;
+ }
+
+ if (recs[i].off2 < 0 && recs[i + 1].off1 < 0) {
+ long a, b;
+ recs[uniq].ha = ha;
+ a = recs[uniq].off1 = recs[i].off1;
+ b = recs[uniq].off2 = recs[i + 1].off2;
+ uniq++;
+ }
+ i += 2;
+ }
+
+ if (uniq) {
+ xdp_ha_t **stacks;
+ long alloc, len;
+
+ qsort(recs, uniq, sizeof(xdp_ha_t), xdp_ha_cmp_by_off2);
+
+ alloc = xdl_bogosqrt(uniq);
+ stacks = xdl_malloc(sizeof(xdp_ha_t *) * alloc);
+ if (stacks == NULL)
+ goto error;
+ len = 1;
+ stacks[0] = recs;
+
+ for (i = 1; i < uniq; i++) {
+ long off1 = recs[i].off1;
+ long k;
+
+ if (off1 < stacks[len - 1]->off1) {
+ if (len >= alloc) {
+ alloc *= 2;
+ stacks = xdl_realloc(stacks, sizeof(xdp_ha_t *) * alloc);
+ if (!stacks)
+ goto error;
+ }
+ stacks[k = len++] = NULL;
+ } else {
+ k = patience_bisect_stack(stacks, len - 1, off1);
+ }
+
+ if (k > 0) {
+ recs[i].left = stacks[k - 1];
+ }
+ if (stacks[k]) {
+ stacks[k]->down = &recs[i];
+ recs[i].up = stacks[k];
+ }
+ stacks[k] = &recs[i];
+ }
+
+ if (xdl_patience_split_aux(begin, stacks[len - 1]) < 0) {
+ xdl_free(stacks);
+ goto error;
+ }
+
+ xdl_free(stacks);
+ }
+
+ xdl_free(recs);
+ return 0;
+
+error:
+ xdl_free(recs);
+ return -1;
+}
+
+static int xdl_patience_lcs(xdfenv_t *xe, xduniqmatch_t *begin, xduniqmatch_t *end)
+{
+ unsigned long const *ha1 = xe->xdf1.ha, *ha2 = xe->xdf2.ha;
+ long off1 = begin->i1 + begin->len, lim1 = end->i1;
+ long off2 = begin->i2 + begin->len, lim2 = end->i2;
+ xduniqmatch_t *next;
+
+ for (; off1 < lim1 && off2 < lim2 && ha1[off1] == ha2[off2]; off1++, off2++);
+ for (; off1 < lim1 && off2 < lim2 && ha1[lim1 - 1] == ha2[lim2 - 1]; lim1--, lim2--);
+
+ begin->len += off1 - begin->i1;
+ end->len += end->i1 - lim1;
+ end->i1 = lim1;
+ end->i2 = lim2;
+
+ if (off1 == lim1 || off2 == lim2)
+ return 0;
+
+ if (xdl_patience_split(ha1, ha2, begin, end))
+ return -1;
+
+ for (next = begin->next; next != end; begin = next, next = begin->next) {
+ if (xdl_patience_lcs(xe, begin, next) < 0)
+ return -1;
+ }
+
+ return 0;
+}
static long xdl_split(unsigned long const *ha1, long off1, long lim1,
unsigned long const *ha2, long off2, long lim2,
@@ -321,13 +548,13 @@ int xdl_recs_cmp(diffdata_t *dd1, long off1, long lim1,
return 0;
}
-
int xdl_do_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
xdfenv_t *xe) {
long ndiags;
long *kvd, *kvdf, *kvdb;
xdalgoenv_t xenv;
diffdata_t dd1, dd2;
+ int need_min = (xpp->flags & XDF_NEED_MINIMAL) != 0;
if (xdl_prepare_env(mf1, mf2, xpp, xe) < 0) {
@@ -364,12 +591,54 @@ int xdl_do_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
dd2.rchg = xe->xdf2.rchg;
dd2.rindex = xe->xdf2.rindex;
- if (xdl_recs_cmp(&dd1, 0, dd1.nrec, &dd2, 0, dd2.nrec,
- kvdf, kvdb, (xpp->flags & XDF_NEED_MINIMAL) != 0, &xenv) < 0) {
+ if (xpp->flags & XDF_USE_PATIENCE) {
+ xduniqmatch_t *lcs;
+ long i1, i2;
+
+ lcs = xdl_uniq_match_alloc(0, 0, 0);
+ if (!lcs)
+ goto error;
+ lcs->next = xdl_uniq_match_alloc(xe->xdf1.nreff, xe->xdf2.nreff, 0);
+ if (!lcs->next || xdl_patience_lcs(xe, lcs, lcs->next) < 0) {
+ while ((lcs = xdl_uniq_popfree(lcs)));
+ goto error;
+ }
- xdl_free(kvd);
- xdl_free_env(xe);
- return -1;
+ i1 = i2 = lcs->len;
+ if (lcs->len) {
+ fprintf(stderr, "skip %ld:%ld -> %ld:%ld\n",
+ lcs->i1, i1, lcs->i2, i2);
+ }
+
+ while ((lcs = xdl_uniq_popfree(lcs))) {
+ fprintf(stderr, "usual %ld:%ld -> %ld:%ld\n",
+ i1, lcs->i1, i2, lcs->i2);
+ fprintf(stderr, "l/r: %ld / %ld\n",
+ xe->xdf1.rindex[lcs->i1],
+ xe->xdf2.rindex[lcs->i2]);
+ if (xdl_recs_cmp(&dd1, i1, lcs->i1, &dd2, i2, lcs->i2,
+ kvdf, kvdb, need_min, &xenv) < 0) {
+ while ((lcs = xdl_uniq_popfree(lcs)));
+ goto error;
+ }
+ i1 = lcs->i1 + lcs->len;
+ i2 = lcs->i2 + lcs->len;
+ if (lcs->len) {
+ fprintf(stderr, "skip %ld:%ld -> %ld:%ld (len %ld)\n",
+ lcs->i1, i1, lcs->i2, i2, lcs->len);
+ fprintf(stderr, "l/r: %ld / %ld\n",
+ xe->xdf1.rindex[lcs->i1 + lcs->len],
+ xe->xdf2.rindex[lcs->i2 + lcs->len]);
+ }
+ }
+ } else {
+ if (xdl_recs_cmp(&dd1, 0, dd1.nrec, &dd2, 0, dd2.nrec,
+ kvdf, kvdb, need_min, &xenv) < 0) {
+error:
+ xdl_free(kvd);
+ xdl_free_env(xe);
+ return -1;
+ }
}
xdl_free(kvd);
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply related
* Re: Repo corrupted somehow?
From: Andrew Arnott @ 2008-11-04 15:12 UTC (permalink / raw)
To: git
In-Reply-To: <216e54900811032334y35ada7daw753c0ad3073c0317@mail.gmail.com>
Nah, that wasn't a false alarm after all. It's happening again, only
this time for dozens of files, and
git rebase --abort
git reset --hard
is not helping.
On Mon, Nov 3, 2008 at 11:34 PM, Andrew Arnott <andrewarnott@gmail.com> wrote:
> I guess I was still in the middle of a rebase. git rebase --abort
> sort of ultimately fixed it.
>
> On Mon, Nov 3, 2008 at 11:09 PM, Andrew Arnott <andrewarnott@gmail.com> wrote:
>> I was just git commit'ing, and then I was doing a git rebase to squash
>> several commits into one when the rebase failed. I then did a
>> git checkout -f master
>> git reset --hard
>> but no matter what I do, git thinks that several files have changed.
>> The diff shows all the lines in these several files removed and then
>> added, yet without any changes made to them. git reset --hard doesn't
>> revert the change. When I jump around history with git checkout these
>> files remain in their "changed" state. I even tried "git clone" to
>> create a whole new repo, but one of these several files STILL
>> registered as changed before I made any changes.
>>
>> Any idea what's wrong and how to recover?
>>
>> Observe the below command buffer: (I can upload my repo so you can
>> clone it and perhaps repro it if you want).
>>
>> Andrew@LACKY /c/git/dotnetoauth
>> $ git status
>> # On branch master
>> # Changed but not updated:
>> # (use "git add <file>..." to update what will be committed)
>> #
>> # modified: tools/Documentation.targets
>> # modified: tools/DotNetOpenAuth.Common.Settings.targets
>> # modified: tools/DotNetOpenAuth.Versioning.targets
>> # modified:
>> tools/Sandcastle/Presentation/vs2005/Content/reference_content.xml
>> # modified: tools/libcheck.ps1
>> # modified: tools/sandcastle.targets
>> #
>> no changes added to commit (use "git add" and/or "git commit -a")
>>
>> Andrew@LACKY /c/git/dotnetoauth
>> $ git reset --hard
>> HEAD is now at 13d37b8 Patching up the bad merges in the phases.
>>
>> Andrew@LACKY /c/git/dotnetoauth
>> $ git status
>> # On branch master
>> # Changed but not updated:
>> # (use "git add <file>..." to update what will be committed)
>> #
>> # modified: tools/Documentation.targets
>> # modified: tools/DotNetOpenAuth.Common.Settings.targets
>> # modified: tools/DotNetOpenAuth.Versioning.targets
>> # modified:
>> tools/Sandcastle/Presentation/vs2005/Content/reference_content.xml
>> # modified: tools/libcheck.ps1
>> # modified: tools/sandcastle.targets
>> #
>> no changes added to commit (use "git add" and/or "git commit -a")
>>
>
^ permalink raw reply
* Re: Stgit and refresh-temp
From: Jon Smirl @ 2008-11-04 14:50 UTC (permalink / raw)
To: Karl Hasselström, Catalin Marinas, Git Mailing List
In-Reply-To: <9e4733910811040538v604d33e3jf0b312d809630af2@mail.gmail.com>
I think I fixed my tree up. After a stg repair I was able to delete
'refresh-temp' which was empty, then apply the changes to jds-lirc.
It may have been possible to make the merge smarter. The conflicts
were with things in the popped-off patches. Your typical end of file
append merge conflicts.
On Tue, Nov 4, 2008 at 8:38 AM, Jon Smirl <jonsmirl@gmail.com> wrote:
> jonsmirl@terra:~/fs$ stg version
> Stacked GIT 0.14.3.270.g0f36
> git version 1.6.0.3.523.g304d0
> Python version 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
> [GCC 4.3.2]
> jonsmirl@terra:~/fs$
>
> --
> Jon Smirl
> jonsmirl@gmail.com
>
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Re: libxdiff and patience diff
From: Johannes Schindelin @ 2008-11-04 14:34 UTC (permalink / raw)
To: Pierre Habouzit; +Cc: davidel, Git ML
In-Reply-To: <20081104083042.GB3788@artemis.corp>
Hi,
On Tue, 4 Nov 2008, Pierre Habouzit wrote:
> On Tue, Nov 04, 2008 at 05:39:48AM +0000, Johannes Schindelin wrote:
>
> > On Tue, 4 Nov 2008, Pierre Habouzit wrote:
> >
> > > I've been working tonight, trying to make libxdiff support the
> > > patience diff algorithm, but I've totally failed, because I
> > > _thought_ I understood what xdl_split was doing, but it appears I
> > > don't.
> >
> > I thought about it, too, at the GitTogether, although I want to finish
> > my jGit diff first.
> >
> > The main idea I had about patience diff is that you can reuse a lot of
> > functions in libxdiff.
> >
> > But the requirement of taking just unique lines/hashes into account,
> > and _after_ splitting up, _again_ determine uniqueness _just_ in the
> > between-hunk part made me think that it may be wiser to have a
> > separate function for the patience diff stuff.
> >
> > Basically, you would start to have libxdiff split the lines and hash
> > them as normal, but then determine the unique hashes (I'd start with
> > the smaller text, just to have a better chance to end up with unique
> > hashes).
> >
> > Once they are determined, you can search for those exact lines (hash
> > first) in the post-document.
>
> Actually my current implementation just puts all the hashes into an
> array, sorts them by hash (which is O(n log(n)) with the position from
> left or right file it's in, ordered by increasing right position. (and
> the struct is filled with the left pos to -1 if the right pos is set,
> and vice versa).
Yeah, that would be much more efficient using a hash-multiset. Still
linear size (albeit twice as much). And you can already discard double
entries early (although you have to keep one pointer in the hash-multiset
to prevent other identical lines from being misdetected as "unique").
> The I scan the array to find patterns of two consecutive hashes exactly,
> and collapse it into the proper {left pos, right pos} tuple if it was
> indeed a unique line in both files.
>
> This results into an array I sort again by right pos then, and we can
> work on that for the stack sorting, and I do it, and then I have my LCS.
>
>
> This is the complete brute-force algorithm which requires a temporary
> array of the size of the number of lines on the left + the right, and a
> temporary array for the stacks which _may_ end up being as large as the
> smallest number of lines between the left or right file in the worst
> case I'd say (roughly).
>
> Then I just remember a list of split points, and I recurse in all the
> sub splits again. It has a fixed point which may or may not need
> libxdiff recursion in it.
I am not sure that you really end up with patience diff that way. I
_think_ that you need to determine the longest sequence of unique lines
which has the property of being ordered in both texts first, and only
_then_ recurse into the not-yet-handled lines.
> > Once that is done, you'd have to find the longest common subsequence,
> > which you could do using the existing infrastructure, but that would
> > require more work (as we already know the lines are unique).
>
> Patience diff gives you the algorithm to do that, it's pretty simple,
> and is more efficient than the current infrastructure (in time, I don't
> know for space though).
Actually, IIRC it is pretty easy to see that the time complexity is linear
(and therefore, the space complexity, too).
> > After that, you would have to recurse to the same algorithm _between_
> > known chunks. Eventually, that would have to resort to classical
> > libxdiff (if there are no, or not enough, unique lines).
>
> Yeah, that's the point, the problem is, I believe more and more that I
> should prepare the LCS from patience diff in xprepare.c, but I grok
> absolutely nothing at what the chastore_t and similar stuff is. I
> understand it's about hashing, but the exact stuff it does eludes me.
Yes, I do not like the short and unintuitive names either.
AFAIU chastore_t is just a generic extensible array of elements that have
size "isize", and initially there are "icount" of them.
> In fact when I look at the records I have in xdiffi.c I had the
> impression they were already somehow collapsed, which makes it a too
> late point to apply the patience diff ...
AFAICS xdiffi.c contains the classical diff algorithm (incidentally, I the
inventor of that algorithm is about 50 meters away from me at this very
moment). It should not have anything of interest to you, except for the
fall-back case.
So I think that you should add a new file xpatience.c.
In that, I'd implement that hash multi-set, and use a prepared xdfenv_t to
fill it (smaller file first, then you can traverse the other file,
checking for uniqueness in that file and for a match in the other file at
the same time).
You _could_ build the longest list of ordered pairs at the same time, too,
but that may make the code a bit too complex.
Ciao,
Dscho
^ permalink raw reply
* Re: Stgit and refresh-temp
From: Jon Smirl @ 2008-11-04 13:38 UTC (permalink / raw)
To: Karl Hasselström, Catalin Marinas, Git Mailing List
In-Reply-To: <9e4733910811040537p4e88c09an94370154eca12778@mail.gmail.com>
jonsmirl@terra:~/fs$ stg version
Stacked GIT 0.14.3.270.g0f36
git version 1.6.0.3.523.g304d0
Python version 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
[GCC 4.3.2]
jonsmirl@terra:~/fs$
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Stgit and refresh-temp
From: Jon Smirl @ 2008-11-04 13:37 UTC (permalink / raw)
To: Karl Hasselström, Catalin Marinas, Git Mailing List
I hit a case when refreshing a buried patch that needed a merge
conflict sorted out.
I'm unable to recover out of the state.
jonsmirl@terra:~/fs$ stg status
A drivers/input/ir/ir-configfs.c
A drivers/input/ir/ir-core.c
A drivers/input/ir/ir.h
C drivers/input/ir/Makefile
D drivers/input/ir-configfs.c
D drivers/input/ir-core.c
D drivers/input/ir.h
M drivers/input/Makefile
M drivers/input/input.c
jonsmirl@terra:~/fs$ gedit drivers/input/Makefile drivers/input/input.c
jonsmirl@terra:~/fs$ gedit drivers/input/ir/Makefile
jonsmirl@terra:~/fs$ stg resolve drivers/input/ir/Makefile
jonsmirl@terra:~/fs$ stg help
usage: stg <command> [options]
Generic commands:
help print the detailed command usage
version display version information
copyright display copyright information
Repository commands:
clone Make a local clone of a remote repository
id Print the git hash value of a StGit reference
Stack (branch) commands:
branch Branch operations: switch, list, create, rename, delete, ...
clean Delete the empty patches in the series
coalesce Coalesce two or more patches into one
commit Permanently store the applied patches into the stack base
float Push patches to the top, even if applied
goto Push or pop patches to the given one
hide Hide a patch in the series
init Initialise the current branch for use with StGIT
log Display the patch changelog
patches Show the applied patches modifying a file
pop Pop one or more patches from the stack
pull Pull changes from a remote repository
push Push one or more patches onto the stack
rebase Move the stack base to another point in history
redo Undo the last undo operation
repair Fix StGit metadata if branch was modified with git commands
reset Reset the patch stack to an earlier state
series Print the patch series
sink Send patches deeper down the stack
top Print the name of the top patch
uncommit Turn regular git commits into StGit patches
undo Undo the last operation
unhide Unhide a hidden patch
Patch commands:
delete Delete patches
edit edit a patch description or diff
export Export patches to a directory
files Show the files modified by a patch (or the current patch)
fold Integrate a GNU diff patch into the current patch
import Import a GNU diff file as a new patch
mail Send a patch or series of patches by e-mail
new Create a new, empty patch
pick Import a patch from a different branch or a commit object
refresh Generate a new commit for the current patch
rename Rename a patch
show Show the commit corresponding to a patch
sync Synchronise patches with a branch or a series
Index/worktree commands:
diff Show the tree diff
resolved Mark a file conflict as solved
status Show the tree status
jonsmirl@terra:~/fs$ stg help coalesce
jonsmirl@terra:~/fs$ stg series
+ Makefile
+ anton_1
+ anton_3
+ add-of_find_i2c_device_by_node
+ jds_platform
+ max9485
+ jds-soc-machine
+ jds-psc-c
+ soc-u32-cleanup
+ jds-audio
+ g_spi_4
+ m_1
+ spi-mmc
+ mpc5200-rtc
+ lirc
+ jds-lirc
> refresh-temp
- jds-lirc-gpt
- jds-lirc-device-tree
- jds-lirc-mce2
jonsmirl@terra:~/fs$ ls
arch Documentation init MAINTAINERS net
samples usr vmlinux.strip.gz
block drivers ipc Makefile patches-master scripts virt
COPYING firmware Kbuild mm patches-save
security vmlinux
CREDITS fs kernel modules.order README sound
vmlinux.bin.gz
crypto include lib Module.symvers REPORTING-BUGS
System.map vmlinux.o
jonsmirl@terra:~/fs$ mv patches-master patches-foo
jonsmirl@terra:~/fs$ stg export
Checking for changes in the working directory ... done
Warning: Local changes in the tree; you might want to commit them first
jonsmirl@terra:~/fs$ stg status
A drivers/input/ir/ir-configfs.c
A drivers/input/ir/ir-core.c
A drivers/input/ir/ir.h
D drivers/input/ir-configfs.c
D drivers/input/ir-core.c
D drivers/input/ir.h
M drivers/input/Makefile
M drivers/input/input.c
M drivers/input/ir/Makefile
jonsmirl@terra:~/fs$ ls patches-master
add-of_find_i2c_device_by_node g_spi_4 jds_platform lirc
max9485 series
anton_1 jds-audio jds-psc-c m_1
mpc5200-rtc soc-u32-cleanup
anton_3 jds-lirc jds-soc-machine Makefile
refresh-temp spi-mmc
jonsmirl@terra:~/fs$ vi patches-master/refresh-temp
jonsmirl@terra:~/fs$ stg series
+ Makefile
+ anton_1
+ anton_3
+ add-of_find_i2c_device_by_node
+ jds_platform
+ max9485
+ jds-soc-machine
+ jds-psc-c
+ soc-u32-cleanup
+ jds-audio
+ g_spi_4
+ m_1
+ spi-mmc
+ mpc5200-rtc
+ lirc
+ jds-lirc
> refresh-temp
- jds-lirc-gpt
- jds-lirc-device-tree
- jds-lirc-mce2
jonsmirl@terra:~/fs$ stg refresh -p jds-lirc
Error: HEAD and top are not the same.
This can happen if you modify a branch with git.
"stg repair --help" explains more about what to do next.
stg refresh: Command aborted (all changes rolled back)
jonsmirl@terra:~/fs$ stg refresh
Error: HEAD and top are not the same.
This can happen if you modify a branch with git.
"stg repair --help" explains more about what to do next.
stg refresh: Command aborted (all changes rolled back)
jonsmirl@terra:~/fs$ stg new foo
Invoking the editor: "vi .stgit-new.txt" ... done
Error: HEAD and top are not the same.
This can happen if you modify a branch with git.
"stg repair --help" explains more about what to do next.
stg new: Command aborted (all changes rolled back)
jonsmirl@terra:~/fs$ stg new foo
Invoking the editor: "vi .stgit-new.txt" ... done
Error: HEAD and top are not the same.
This can happen if you modify a branch with git.
"stg repair --help" explains more about what to do next.
stg new: Command aborted (all changes rolled back)
jonsmirl@terra:~/fs$ stg repair --help
Usage: stg repair
Fix StGit metadata if branch was modified with git commands
Options:
-h, --help show this help message and exit
jonsmirl@terra:~/fs$
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* More help needed on merging unrelated repos
From: Christian MICHON @ 2008-11-04 13:14 UTC (permalink / raw)
To: Git Mailing List
Hi,
I previously posted here a question on how to merge unrelated repos,
and I was quite happy with the answer.
git pull repo_name repo_branch
Yet, when I merge these repos (they're unrelated), I'd like to merge
all of them at once.
How do I pull for example 2 repos in 1 command ? I cannot figure out
the exact syntax to use.
I tried:
git pull ../i1 0.5 ../i2 master
git pull ../i1 0.5 -- ../i2 master
I also tried to play with --no-commit and -s to no avail.
Does anyone of you already use this and knows the trick ? Thanks in advance!
--
Christian
--
http://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !
^ permalink raw reply
* RE: CRLF support bugs (was: Re: .gitattributes glob matchingbroken)
From: Kelly F. Hickel @ 2008-11-04 12:37 UTC (permalink / raw)
To: Jeff King, Hannu Koivisto; +Cc: git
In-Reply-To: <20081104051432.GD31276@coredump.intra.peff.net>
> -----Original Message-----
> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
> Behalf Of Jeff King
> Sent: Monday, November 03, 2008 11:15 PM
> To: Hannu Koivisto
> Cc: git@vger.kernel.org
> Subject: Re: CRLF support bugs (was: Re: .gitattributes glob
> matchingbroken)
>
> On Mon, Nov 03, 2008 at 05:05:24PM +0200, Hannu Koivisto wrote:
>
<snip>
> > I think CRLF conversion support should have some attribute (be it
> > .gitattributes attribute or something else) that is somehow
> > inherited from the parent repository. It would basically say that
> > "you should use platform's native line end type for text files with
> > this repository and its children". To go with that, one would
> > maybe have a configuration option to tell what that platform
> > default line end type is (just in case someone wants to pretend
> > Cygwin is Unix or something like that).
>
> I think others have complained before about something like this, in
> that
> it really is a _local_ decision and not a _project_ decision to make. I
> am fortunate enough to work exclusively on platforms with sane line
> endings, so I don't know what is normal.
From my point of view, the factoid that a particular file should be subjected to having its line endings munged is a _project_ decision. Whether or not to munge them on any given platform is a _local_ decision.
I work on various UNIXes, Linux, Windows, z/OS, etc, etc, and I want the tool to just do the right thing so that I don't have to think about it on a daily basis.
My $0.02....
-Kelly
>
> But if you really wanted to do such a thing for some set of corporate
> users, maybe it would make sense to have a "clone" hook that runs after
> init and can set up any relevant config (e.g., by copying certain
> config
> values from the parent repo).
>
> -Peff
^ permalink raw reply
* RE: why not TortoiseGit
From: Johannes Schindelin @ 2008-11-04 12:52 UTC (permalink / raw)
To: Li Frank; +Cc: Nigel Magnay, Scott Chacon, Andreas Ericsson, Ian Hilt, git
In-Reply-To: <7FD1F85C96D70C4A89DA1DF7667EAE961E75EA@zch01exm23.fsl.freescale.net>
Hi,
On Tue, 4 Nov 2008, Li Frank wrote:
> TortoriseGIt should be in windows platform only because it is extension
> of explore.
FYI I completely disagree with this reasoning.
Ciao,
Dscho
^ permalink raw reply
* [PATCH 3/3] tag: Add more tests about mixing incompatible modes and options
From: Samuel Tardieu @ 2008-11-04 12:42 UTC (permalink / raw)
To: git
In-Reply-To: <20081104124207.18273.31679.stgit@arrakis.enst.fr>
Signed-Off-By: Samuel Tardieu <sam@rfc1149.net>
---
t/t7004-tag.sh | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index f0edbf1..f377fea 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -1090,4 +1090,15 @@ test_expect_success 'filename for the message is relative to cwd' '
git cat-file tag tag-from-subdir-2 | grep "in sub directory"
'
+# mixing modes and options:
+
+test_expect_success 'mixing incompatibles modes and options is forbidden' '
+ test_must_fail git tag -a
+ test_must_fail git tag -l -v
+ test_must_fail git tag -n 100
+ test_must_fail git tag -l -m msg
+ test_must_fail git tag -l -F some file
+ test_must_fail git tag -v -s
+'
+
test_done
^ permalink raw reply related
* [PATCH 2/3] tag: Check that options are only allowed in the appropriate mode
From: Samuel Tardieu @ 2008-11-04 12:42 UTC (permalink / raw)
To: git
In-Reply-To: <20081104124207.18273.31679.stgit@arrakis.enst.fr>
"git tag" should not silently accept unrecognized options when operating
in a given mode. For example, "git tag -n 100", which may be a typo for
"git tag -n100", should not silently create a tag named "100".
Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
---
builtin-tag.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/builtin-tag.c b/builtin-tag.c
index 5ce0e21..d339971 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -344,7 +344,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
const char *object_ref, *tag;
struct ref_lock *lock;
- int annotate = 0, sign = 0, force = 0, lines = 0,
+ int annotate = 0, sign = 0, force = 0, lines = -1,
list = 0, delete = 0, verify = 0;
const char *msgfile = NULL, *keyid = NULL;
struct msg_arg msg = { 0, STRBUF_INIT };
@@ -383,10 +383,16 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
if (argc == 0 && !(delete || verify))
list = 1;
+ if ((annotate || msg.given || msgfile || force) &&
+ (list || delete || verify))
+ usage_with_options(git_tag_usage, options);
+
if (list + delete + verify > 1)
usage_with_options(git_tag_usage, options);
if (list)
- return list_tags(argv[0], lines);
+ return list_tags(argv[0], lines == -1 ? 0 : lines);
+ if (lines != -1)
+ die("-n option is only allowed with -l.");
if (delete)
return for_each_tag_name(argv, delete_tag);
if (verify)
^ permalink raw reply related
* [PATCH 1/3] tag: Do not allow to call "git tag" in more than one operating mode
From: Samuel Tardieu @ 2008-11-04 12:42 UTC (permalink / raw)
To: git
If "git tag -d -l -v ..." is called, only "-l" is honored, which is
arbitrary and wrong.
This patch checks that "git tag" knows in what mode it operates before
performing any operation.
Signed-Off-By: Samuel Tardieu <sam@rfc1149.net>
---
builtin-tag.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/builtin-tag.c b/builtin-tag.c
index 84db156..5ce0e21 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -380,7 +380,11 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
}
if (sign)
annotate = 1;
+ if (argc == 0 && !(delete || verify))
+ list = 1;
+ if (list + delete + verify > 1)
+ usage_with_options(git_tag_usage, options);
if (list)
return list_tags(argv[0], lines);
if (delete)
@@ -406,11 +410,6 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
}
}
- if (argc == 0) {
- if (annotate)
- usage_with_options(git_tag_usage, options);
- return list_tags(NULL, lines);
- }
tag = argv[0];
object_ref = argc == 2 ? argv[1] : "HEAD";
^ permalink raw reply related
* Re: Git SVN Rebranching Issue
From: Matt Kern @ 2008-11-04 11:24 UTC (permalink / raw)
To: Dmitry Potapov; +Cc: Eric Wong, git
In-Reply-To: <20081104094224.GC24100@dpotapov.dyndns.org>
> > It was actually an intentional design decision on my part preserve
> > parents based on branch name. We would eventually otherwise lose
> > history of the now-deleted branches, as reflogs can expire.
>
> Would it not be better to save the old branch using "@SVN-NUMBER" as
> suffix? Thus, those do not need the old branch can easily delete it.
I would second this approach.
Our svn repository isn't particularly big or old, but if someone were to
make a branch now, there is a fair chance it will have the same name as
an old branch but have absolutely nothing to do with that old branch.
The situation will only get worse as our svn repository grows and more
branches are created/deleted.
Matt
--
Matt Kern
http://www.undue.org/
^ permalink raw reply
* Re: Fetch via http and proxy which requires authentication
From: Paolo Ciarrocchi @ 2008-11-04 11:13 UTC (permalink / raw)
To: Dilip M; +Cc: Git Mailing List
In-Reply-To: <c94f8e120811030602p57007278p5a2c48ce7663282d@mail.gmail.com>
On Mon, Nov 3, 2008 at 3:02 PM, Dilip M <dilipm79@gmail.com> wrote:
> On Thu, Aug 28, 2008 at 3:43 PM, Paolo Ciarrocchi
> <paolo.ciarrocchi@gmail.com> wrote:
>>> Hi all,
>>> i'm looking for a way to use git behind a corporate proxy which
>>> requires authentication.
>>> i just need to be able to fetch/pull via http.
>>> i'm using git on a win xp box.
>>> Any hint?
>>
>> Yes, google for http_proxy ;-)
>>
>> export http_proxy=http://host:port
>> git clone http://username:password@giturl
>
> I tried setting, export http_proxy=http://<user>:<password>@host:port
>
> But git clone failed!
>
> $git clone http://kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git git
> clone http://kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> Initialized empty Git repository in /home/dilipm/bin/linux-2.6/.git/
> fatal:
> http://kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git/info/refs
> download error - The requested file was not found
>
> What may the problem? How can debug....
Works for me:
$ git version
git version 1.6.0.2.1172.ga5ed0
I set in the Environment Variables panel:
Variable Value
http_proxy http://ip_of_my_proxy
Regards,
--
Paolo
http://paolo.ciarrocchi.googlepages.com/
^ permalink raw reply
* Re: Intensive rename detection
From: Björn Steinbrink @ 2008-11-04 10:47 UTC (permalink / raw)
To: Andrew Arnott; +Cc: Jeff King, Junio C Hamano, Linus Torvalds, git
In-Reply-To: <216e54900811032236l5ae4bde5v16ab6519962e428f@mail.gmail.com>
On 2008.11.03 22:36:42 -0800, Andrew Arnott wrote:
> On Mon, Nov 3, 2008 at 10:16 PM, Jeff King <peff@peff.net> wrote:
> > On Mon, Nov 03, 2008 at 10:02:37PM -0800, Andrew Arnott wrote:
> >
> >> Hmmm.... actually on second run I am still getting the too many files
> >> warning. I put the [diff] section in a ~/.gitconfig file, a
> >> .gitconfig file in the root of my repo, and in the .git/config file,
> >> but none of them seem to get rid of the message.
> >
> > Where are you getting the warning? On "git status"?
> >
> > If so, then this is an instance of the problem I mentioned here:
> >
> > [PATCH v3 7/8] wt-status: load diff ui config
> > 20081026044935.GG21047@coredump.intra.peff.net
>
> Yes, on git status. I'm afraid I don't know how to look up the
> reference you gave.
http://marc.info/?l=git&m=122499658810367&w=2
Björn
^ permalink raw reply
* Re: Git SVN Rebranching Issue
From: Sverre Rabbelier @ 2008-11-04 10:15 UTC (permalink / raw)
To: Dmitry Potapov; +Cc: Eric Wong, Matt Kern, git
In-Reply-To: <20081104094224.GC24100@dpotapov.dyndns.org>
On Tue, Nov 4, 2008 at 10:42, Dmitry Potapov <dpotapov@gmail.com> wrote:
> On Tue, Nov 04, 2008 at 12:41:11AM -0800, Eric Wong wrote:
>> Short answer: you can use grafts to remove parents.
>
> Using grafts requires some cautious, especially when it is used to make
> some commits unreachable, because git gc can remove unreachable commits.
> Also, a repository with grafts cannot be cloned. So using grafts looks
> like more as workaround rather a real solution
I think what was meants is to use grafts and then make them permanent
with 'git filter-branch'.
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: locate commit by file
From: Jakub Narebski @ 2008-11-04 9:57 UTC (permalink / raw)
To: Ittay Dror; +Cc: Git Mailing List
In-Reply-To: <491003BC.7040206@gmail.com>
Ittay Dror <ittay.dror@gmail.com> writes:
> Given a file, is there an easy way (e.g., not bisecting) to find the
> latest commit where the file content is the same?
>
> Meaning: I have a file /tmp/A and I want to file the latest commit
> where a/b/A is identical (content wise) to /tmp/A.
Do you mean: find the commit which changed file to current version?
I think that
$ git rev-parse -1 -- file
Would work (but better check "git log -- file").
If you want to find which version corresponds to given contents, you
would have to find sha-1 of /tmp/A (using "git hash-object"), and
find it in difftree searching for sha ("git log --raw -- file", or
just "git log --raw" if you are not sure about name).
I think you can fins such script in mailing list archives...
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply
* Re: Git SVN Rebranching Issue
From: Dmitry Potapov @ 2008-11-04 9:42 UTC (permalink / raw)
To: Eric Wong; +Cc: Matt Kern, git
In-Reply-To: <20081104084111.GB14405@untitled>
On Tue, Nov 04, 2008 at 12:41:11AM -0800, Eric Wong wrote:
>
> Short answer: you can use grafts to remove parents.
Using grafts requires some cautious, especially when it is used to make
some commits unreachable, because git gc can remove unreachable commits.
Also, a repository with grafts cannot be cloned. So using grafts looks
like more as workaround rather a real solution.
>
> It was actually an intentional design decision on my part preserve
> parents based on branch name. We would eventually otherwise lose
> history of the now-deleted branches, as reflogs can expire.
Would it not be better to save the old branch using "@SVN-NUMBER" as
suffix? Thus, those do not need the old branch can easily delete it.
Dmitry
^ permalink raw reply
* Re: [PATCH] Documentation: add a planning document for the next CLI revamp
From: Dmitry Potapov @ 2008-11-04 9:18 UTC (permalink / raw)
To: Sam Vilain
Cc: Junio C Hamano, Jeff King, Sam Vilain, git, Johannes Schindelin,
Scott Chacon, Tom Preston-Werner, J.H., Christian Couder,
Kai Blin
In-Reply-To: <1225691960.20883.41.camel@maia.lan>
On Mon, Nov 03, 2008 at 06:59:20PM +1300, Sam Vilain wrote:
>
> I can see that some people want this behaviour by default; but to me
> "push the current branch back to where it came from" seems like far more
> a rational default for at least 90% of users.
I think it depends on one's workflow. If you use a centralized workflow
as with CVS then yes, 90% cases you want to push the current branch. On
the other hand, if people push their changes to the server only for
review, it means that accidentally pushing more than one intended is not
a big deal. The only one who does publishing to the official repository
is the maintainer, and the maintainer is most likely to run some tests
after merging all changes, which takes some time. So, it is rarely push
the current branch, it is usually the branch that has been tested, so
the name of the branch should be specified explicitly anyway.
Dmitry
^ permalink raw reply
* Re: [PATCH] push: fix local refs update if already up-to-date
From: Clemens Buchacher @ 2008-11-04 9:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, git
In-Reply-To: <7v7i7jsx6a.fsf@gitster.siamese.dyndns.org>
On Tue, Nov 04, 2008 at 12:38:37AM -0800, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > Though I am not happy that we have to look up the tracking ref for every
> > uptodate ref. I think it shouldn't be a big performance problem with
> > packed refs, though, since they are cached (i.e., we pay only to compare
> > the hashes, not touch the filesystem for each ref).
>
> It is either (1) the user pays the cost of finding what remote tracking
> branch we are mirroring when you push for all up-to-date refs, like you
> did in your "here is an improvement" patch; or (2) the user pays the cost
> of fetching from there, immediately after pushing. I'd imagine that the
> cost to do (1) would be smaller than (2). The question is if seeing stale
> tracking branches is such a big deal, as next "git fetch" from there will
> update them anyway. If it is a big deal, (1) would be a price worth
> paying.
Right. I think it is a big deal. I found out about this bug, because a user
on #git was confused by the fact that push reported "Everything up-to-date",
even though there were changes. A fetch fixed that, of course. But it is
confusing and inconsistent with normal push behavior. So I really think it's
worth a small performance hit.
> Clemens, care to reroll the patch?
I will do so later today.
^ permalink raw reply
* Re: [PATCH] push: fix local refs update if already up-to-date
From: Clemens Buchacher @ 2008-11-04 8:56 UTC (permalink / raw)
To: Jeff King; +Cc: git, Junio C Hamano
In-Reply-To: <20081104042643.GA31276@coredump.intra.peff.net>
On Mon, Nov 03, 2008 at 11:26:44PM -0500, Jeff King wrote:
> > The hashcpy for new_ref is now executed more often than absolutely
> > necessary. But this is not a critical path, right? So I decided to keep
> > things simple.
>
[...]
> Your patch makes ref->new_sha1 "valid" for every status case. Ordinarily
> I would be in favor of that, since it reduces coupling with other parts
> of the code (which have to know _which_ status flags provide a useful
> value in ->new_sha1). But in this case, I think the value we would be
> sticking in is not necessarily useful for every status flag we end up
> setting; so any consumers of the ref structure still need to know which
> flags set it. So even though it has a defined value, it is not really
> "valid" in all cases.
The other status flags are REF_STATUS_REJECT_NODELETE and
REF_STATUS_REJECT_NONFASTFORWARD. So in these cases the "new sha1" is going
to be the "old sha1". The default for new_sha1 is the null sha1. So while
the sha1 we're trying to push may not be more valid than the null sha1, it's
not less valid either, is it? And it even makes sense if you interpret
new_sha1 as the sha1 the client attempts to push.
> Hmm. I was hoping to see more in update_tracking_ref. With your patch,
> we end up calling update_ref for _every_ uptodate ref, which results in
> writing a new unpacked ref file for each one. And that _is_ a
> performance problem for people with large numbers of refs.
>
> So I think we need a check to make sure we aren't just updating with the
> same value. Something like:
I think update_ref already takes care of that. See this check in
write_ref_sha1:
if (!lock->force_write && !hashcmp(lock->old_sha1, sha1)) {
unlock_ref(lock);
return 0;
}
> Though I am not happy that we have to look up the tracking ref for every
> uptodate ref. I think it shouldn't be a big performance problem with
> packed refs, though, since they are cached (i.e., we pay only to compare
> the hashes, not touch the filesystem for each ref).
I don't think we can avoid that, though.
I agree with your other comments.
^ permalink raw reply
* Re: [Q] Abbreviated history graph?
From: Junio C Hamano @ 2008-11-04 8:45 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Brian Foster, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0811031211180.3419@nehalem.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Mon, 3 Nov 2008, Linus Torvalds wrote:
>>
>> I'll post a simple series of four commits in a moment.
> ...
> Side note: it's certainly possible that we could improve on this. Right
> now, "--simplify-namespace" will totally override any path simplification,
> so you can't get a combination of pathnames _and_ naming commits. I don't
> know exactly what the rules should be, but I could imagine that we could
> do something like:
>
> - if no pathnames are given, work the way the current patch-series works.
>
> - if path-names are given, make rev_compare_tree() truen
> REV_TREE_DIFFERENT if a name decoration _or_ a tree difference exists.
>
> Anyway, that's a fairly trivial extension to the idea, and doesn't really
> matter for the basic code. It can easily be left for later.
Thanks.
Including this (and the --source one), the series looks reasonable.
^ permalink raw reply
* git-p4: Importing multiple p4 prods into same git repo
From: dhruva @ 2008-11-04 8:42 UTC (permalink / raw)
To: Git
Hi,
I have the p4 layout as follows:
1. //depot/prod/devel/main
2. //depot/prod/devel/hacks
where #2 is a sort of fork of #1. There are lot of common objects
between them and #2 can trace its history to #1. I would like to
import both the above paths under the same git repository as 2 remote
branches so that they can share objects and reduce overall size. Is
this possible using 'git-p4'. I went through the code and got lost in
the complexities...
I urgently need this to consolidate multiple paths under the same git
folder and be able to serve them soon. Any help is greatly
appreciated.
-dhruva
--
Contents reflect my personal views only!
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox