git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug: no-op "rebase -i" failures (easily reproduceable)

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 1, 2012, 19:45 UTC
Message-ID
<7vboogm7g3.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAFjr8EukvC6zsa2vzUWL+YDNLMUh5apmwGQZ1s5WkHg-bC17Kw@mail.gmail.com>
Luiz-Otavio Zorzella <zorzella@gmail.com> writes:
Show 9 quoted lines
> $ EDITOR=echo git rebase -i HEAD~40
> /usr/local/google/z/gitblow/git/.git/rebase-merge/git-rebase-todo
> error: could not apply ec7ff5b... make lineno_width() from blame
> reusable for others
>
> When you have resolved this problem run "git rebase --continue".
> If you would prefer to skip this patch, instead run "git rebase --skip".
> To check out the original branch and stop rebasing run "git rebase --abort".
> Could not apply ec7ff5b... make lineno_width() from blame reusable for others

That is hardly surprising, given that you asked to flatten the history since the 40 commits before the tip of your history, and it is done out of a history that is full of merges from side branches.

And it is not even an error, let alone a bug. The command is asking you to resolve conflict it cannot resolve mechanically. If you do as you are asked, you will do just fine.

It is expected that you will see conflicts in such a rebase, because by attempting to flatten the history you are telling Git to replay a commit to a context that is different from its original context.

A conflict resolution to replay that particular commit to flatten a recent history might look like this, but it depends on where in the history you start the rebase from.

diff --cc cache.h index 3a8e125,24732e6..0000000

--- a/cache.h
+++ b/cache.h
@@@ -1177,7 -1176,7 +1177,8 @@@ extern void setup_pager(void)
  extern const char *pager_program;
  extern int pager_in_use(void);
  extern int pager_use_color;
 +extern int term_columns(void);
+ extern int decimal_width(int);
  
  extern const char *editor_program;
  extern const char *askpass_program;
diff --cc pager.c
index b790967,96c07ba..0000000
--- a/pager.c
+++ b/pager.c
@@@ -118,32 -112,13 +118,44 @@@ int pager_in_use(void
  }
  
  /*
 + * Return cached value (if set) or $COLUMNS environment variable (if
 + * set and positive) or ioctl(1, TIOCGWINSZ).ws_col (if positive),
 + * and default to 80 if all else fails.
 + */
 +int term_columns(void)
 +{
 +	static int term_columns_at_startup;
 +
 +	char *col_string;
 +	int n_cols;
 +
 +	if (term_columns_at_startup)
 +		return term_columns_at_startup;
 +
 +	term_columns_at_startup = 80;
 +
 +	col_string = getenv("COLUMNS");
 +	if (col_string && (n_cols = atoi(col_string)) > 0)
 +		term_columns_at_startup = n_cols;
 +#ifdef TIOCGWINSZ
 +	else {
 +		struct winsize ws;
 +		if (!ioctl(1, TIOCGWINSZ, &ws) && ws.ws_col)
 +			term_columns_at_startup = ws.ws_col;
 +	}
 +#endif
 +
 +	return term_columns_at_startup;
 +}
++
++/*
+  * How many columns do we need to show this number in decimal?
+  */
+ int decimal_width(int number)
+ {
+ 	int i, width;
+ 
+ 	for (width = 1, i = 10; i <= number; width++)
+ 		i *= 10;
+ 	return width;
+ }
Previous: Luiz-Otavio ZorzellaNext: Junio C Hamano
Message 2 of 3 in “Bug: no-op "rebase -i" failures (easily reproduceable)”
  1. Luiz-Otavio ZorzellaMar 1, 2012
  2. Junio C HamanoMar 1, 2012
  3. Junio C HamanoMar 1, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.