Skip to contentSkip to conversation

Question about patches

U-Boot Fabio Giovagnini 7 participants 15 messages Jul 20, 2010

lore
Share & tools
lore
#0 lore raw

Hi all,
for sending a patch do I need to have on my PC two u-bbot tree, one original obtaned by git command, and another to make the modifications?

Or can I produce the patches using the original tree resident on git server?

Thanks

Signature · 9 lines
Fabio Giovagnini

Aurion s.r.l.
P.I e C.F.
00885711200
skype: aurion.giovagnini
Tel. +39.051.594.78.24
Cell. +39.335.83.50.919
www.aurion-tech.com
#1 lore raw
Quoted 6 lines · Fabio Giovagnini

Hi all,
for sending a patch do I need to have on my PC two u-bbot tree, one original obtaned by git command, and another to make the modifications?

Or can I produce the patches using the original tree resident on git server?

Ciao Fabio,

You can use git format patch command to produce numbered patches You can google it to know more

Regards
Vipin

Quoted 2 lines

Thanks

#2 lore raw

Hi Vipin,
I'm not so smart in diff / patch and git tools usage.
Could be so kind to write to me how to build a patch for just one file I have modified in driver/mtd directory of u-boot?

Thanks in advange and sorry for my request, but I read on the net and nothing appeared to be usfull.

Thanks and sorry again

In data marted? 20 luglio 2010 09:00:39, Vipin KUMAR ha scritto:

Quoted 17 lines · Fabio Giovagnini
Quoted 6 lines

Hi all,
for sending a patch do I need to have on my PC two u-bbot tree, one original obtaned by git command, and another to make the modifications?

Or can I produce the patches using the original tree resident on git server?

Ciao Fabio,

You can use git format patch command to produce numbered patches You can google it to know more

Regards
Vipin

Quoted 1 line

Thanks

Signature · 9 lines
Fabio Giovagnini

Aurion s.r.l.
P.I e C.F.
00885711200
skype: aurion.giovagnini
Tel. +39.051.594.78.24
Cell. +39.335.83.50.919
www.aurion-tech.com
#3 lore raw

Hi Fabio

1. git clone git://git.denx.de/u-boot.git u-boot.upstream
2. cd u-boot.upstream/
3. echo "/* just for git test */" >> driver/mtd/dataflash.c
4. git diff
5. git commit -a -s -m "this patch is for test"
6. git format-patch -1

then you will got a 0001-***.patch file.

Quoted 31 lines · Fabio Giovagnini

Hi Vipin,
I'm not so smart in diff / patch and git tools usage.
Could be so kind to write to me how to build a patch for just one file I have modified in driver/mtd directory of u-boot?

Thanks in advange and sorry for my request, but I read on the net and nothing appeared to be usfull.

Thanks and sorry again

In data marted? 20 luglio 2010 09:00:39, Vipin KUMAR ha scritto:

Quoted 17 lines · Fabio Giovagnini
Quoted 6 lines

Hi all,
for sending a patch do I need to have on my PC two u-bbot tree, one original obtaned by git command, and another to make the modifications?

Or can I produce the patches using the original tree resident on git server?

Ciao Fabio,

You can use git format patch command to produce numbered patches You can google it to know more

Regards
Vipin

Quoted 1 line

Thanks

Signature · 3 lines
Best Regards
Xiangfu Liu
http://www.openmobilefree.net
#4 lore raw

Many thanks to you and everybody

Cheers

In data marted? 20 luglio 2010 09:52:50, Xiangfu Liu ha scritto:
: > Hi Fabio

Quoted 41 lines

1. git clone git://git.denx.de/u-boot.git u-boot.upstream
2. cd u-boot.upstream/
3. echo "/* just for git test */" >> driver/mtd/dataflash.c
4. git diff
5. git commit -a -s -m "this patch is for test"
6. git format-patch -1

then you will got a 0001-***.patch file.

Quoted 29 lines · Fabio Giovagnini

Hi Vipin,
I'm not so smart in diff / patch and git tools usage.
Could be so kind to write to me how to build a patch for just one file I have modified in driver/mtd directory of u-boot?

Thanks in advange and sorry for my request, but I read on the net and nothing appeared to be usfull.

Thanks and sorry again

In data marted? 20 luglio 2010 09:00:39, Vipin KUMAR ha scritto:

Quoted 17 lines · Fabio Giovagnini
Quoted 7 lines

Hi all,
for sending a patch do I need to have on my PC two u-bbot tree, one original obtaned by git command, and another to make the modifications?

Or can I produce the patches using the original tree resident on git server?

Ciao Fabio,

You can use git format patch command to produce numbered patches You can google it to know more

Regards
Vipin

Quoted 1 line

Thanks

Signature · 9 lines
Fabio Giovagnini

Aurion s.r.l.
P.I e C.F.
00885711200
skype: aurion.giovagnini
Tel. +39.051.594.78.24
Cell. +39.335.83.50.919
www.aurion-tech.com
#5 lore raw
In reply to Fabio Giovagnini
Quoted 8 lines · Fabio Giovagnini

Hi Vipin,
I'm not so smart in diff / patch and git tools usage.
Could be so kind to write to me how to build a patch for just one file I have modified in driver/mtd directory of u-boot?

Thanks in advange and sorry for my request, but I read on the net and nothing appeared to be usfull.

No problems. It takes a little time to get used to git but then you start liking it. Anyway

you can create a patch for each commit. You can see a summary of commits via "git log"

Basically you need to run git format-patch -n <reference> reference is a branch name or tag or a direct reference to commit from which you want to create patches

eg git format-patch -n origin/master would create numbered patches for commits after the commit pointed to by origin/master

Also, run "gitk --all -1000" to get an understanding of what exactly is happening in the background when you commit a change

Hope this helps a little

Vipin

Quoted 23 lines

Thanks and sorry again

In data marted? 20 luglio 2010 09:00:39, Vipin KUMAR ha scritto:

Quoted 17 lines · Fabio Giovagnini
Quoted 6 lines

Hi all,
for sending a patch do I need to have on my PC two u-bbot tree, one original obtaned by git command, and another to make the modifications?

Or can I produce the patches using the original tree resident on git server?

Ciao Fabio,

You can use git format patch command to produce numbered patches You can google it to know more

Regards
Vipin

Quoted 1 line

Thanks

#6 lore raw
Quoted 11 lines

No problems. It takes a little time to get used to git but then you start liking it. Anyway

you can create a patch for each commit. You can see a summary of commits via "git log"

Basically you need to run git format-patch -n <reference> reference is a branch name or tag or a direct reference to commit from which you want to create patches

Quoted 8 lines

eg git format-patch -n origin/master would create numbered patches for commits after the commit pointed to by origin/master

Also, run "gitk --all -1000" to get an understanding of what exactly is happening in the background when you commit a change

Hope this helps a little

I would also recommend looking at 'Stacked Git' (stgit) - It is basically a wrapper around it which allows you to manage a set of patches and move back and forth between them, merge, re-order etc.

It makes life a lot easier when you make a mess of things :)

Regards,

Graeme

#7 lore raw

Dear Graeme Russ,

Quoted 6 lines · In message <[email protected]> you…

I would also recommend looking at 'Stacked Git' (stgit) - It is basically a wrapper around it which allows you to manage a set of patches and move back and forth between them, merge, re-order etc.

It makes life a lot easier when you make a mess of things :)

What exactly can stgit do that cannot be done with a number of branches and "git rebase -i" ? [Sorry for the stupid question, but I haven't used stgit yet...]

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
We have phasers, I vote we blast 'em!
	-- Bailey, "The Corbomite Maneuver", stardate 1514.2
#8 lore raw
Quoted 7 lines · Wolfgang Denk

Dear Graeme Russ,

Quoted 4 lines · In message <[email protected]> you…

I would also recommend looking at 'Stacked Git' (stgit) - It is basically a wrapper around it which allows you to manage a set of patches and move back and forth between them, merge, re-order etc.

Quoted 5 lines
Quoted 1 line

It makes life a lot easier when you make a mess of things :)

What exactly can stgit do that cannot be done with a number of branches and "git rebase -i" ? [Sorry for the stupid question, but I haven't used stgit yet...]

A wrapper: It probably makes the process even more obscure :)

Reinhard

#9 lore raw
In reply to Wolfgang Denk
Quoted 8 lines · Wolfgang Denk

Dear Graeme Russ,

Quoted 5 lines · In message <[email protected]> you…

I would also recommend looking at 'Stacked Git' (stgit) - It is basically a wrapper around it which allows you to manage a set of patches and move back and forth between them, merge, re-order etc.

Quoted 6 lines
Quoted 1 line

It makes life a lot easier when you make a mess of things :)

What exactly can stgit do that cannot be done with a number of branches and "git rebase -i" ? [Sorry for the stupid question, but I haven't used stgit yet...]

Probably nothing, but it is more straightforward

Lets say you are working on a branch, say 'Testing'

git checkout testing
stg new (opens an editor, allows you to write up a commit message) edit
stg refresh
stg new / edit / stg refresh (as many as you like)

Now you will have a bunch of commits, but maybe they are in the wrong order

eg

[arch commit 1]
[common commit 1]
[arch commit 2]
[board commin 1]
[arch commit 3]

etc, etc

you can then use stg pop/push/merge to re-arrange and merge commits together to get them in a more logical arrangement before submitting

Sometimes when I'm in the middle of a very long development session I tend to end up with one 'big patch' which has multiple logical change units. In this case, you can pop the 'big patch', insert a new smaller patch implementing some of the 'big patch' then when you push the 'big patch', all the duplicate changes are stripped. So you can basically whittle down a big, complex commit into multiple smaller commits very easily.

I'm sure you'll argue that this is poor development management, but I find myself more efficient if a 'get in the zone' and then go back and break things up. It also serves as a really good self imposed code review

It also has some inter-branch managment commands I have never used

Regards,

Graeme

#10 lore raw

Dear Graeme Russ,

Quoted 2 lines · In message <[email protected]> you…

Now you will have a bunch of commits, but maybe they are in the wrong order

...

Quoted 2 lines

you can then use stg pop/push/merge to re-arrange and merge commits together to get them in a more logical arrangement before submitting

With "git rebase -i" I get an editor started like this:

pick 3e9b349 NAND: show manufacturer and device ID for unknown chips pick 1445f6f NAND: add Toshiba TC58NVG0 identifier
pick bc1a884 mtd: nand_plat: add simple GPIO framework DEV_READY option pick 67ceefa Blackfin: convert plat-nand code to GPIO framework pick c9f7351 NAND: environment offset in OOB (CONFIG_ENV_OFFSET_OOB) pick 53504a2 NAND: formatting cleanups from env.oob support
...
# Commands:

#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message

I can reorder, drop, combine (squash), edit patches...

Quoted 6 lines

Sometimes when I'm in the middle of a very long development session I tend to end up with one 'big patch' which has multiple logical change units. In this case, you can pop the 'big patch', insert a new smaller patch implementing some of the 'big patch' then when you push the 'big patch', all the duplicate changes are stripped. So you can basically whittle down a big, complex commit into multiple smaller commits very easily.

We can use "git add -i" to do this as well. You can even split hunks to add them to different commits.

Quoted 3 lines

I'm sure you'll argue that this is poor development management, but I find myself more efficient if a 'get in the zone' and then go back and break things up. It also serves as a really good self imposed code review

No, I don't argue. I'm trying to undestand. I am well aware that there are many tools for the same tasks, and the most efficient ones are these you know well, so "vi" is probably much more eficient to me than your favorite editor is to you. But I always like at least to know what the tools can do that I don't use or don't know that well - sometimes - sometimes i's time to make room in the toolbox for a new tool or another :-)

Thanks!

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Engineering without management is art."               - Jeff Johnson
#11 lore raw

Hi

(share my info :) I am always use stg like this:
for example there are three commit:
commit1, commit2, commit3,
then I edit file:

	a.c, b.c, c.c

and I want
a.c goto commit1.
b.c goto commit2.
c.c goto commit3.

then
stg refresh a.c -p commit1
stg refresh b.c -p commit2
stg refresh c.c -p commit3

I know this is not good. because this may lose change history. but I use this for create patches for OpenWrt system.

Quoted 24 lines · Wolfgang Denk

Dear Graeme Russ,

Quoted 2 lines · In message<[email protected]> you…

Now you will have a bunch of commits, but maybe they are in the wrong order

...

Quoted 2 lines

you can then use stg pop/push/merge to re-arrange and merge commits together to get them in a more logical arrangement before submitting

With "git rebase -i" I get an editor started like this:

pick 3e9b349 NAND: show manufacturer and device ID for unknown chips pick 1445f6f NAND: add Toshiba TC58NVG0 identifier
pick bc1a884 mtd: nand_plat: add simple GPIO framework DEV_READY option pick 67ceefa Blackfin: convert plat-nand code to GPIO framework pick c9f7351 NAND: environment offset in OOB (CONFIG_ENV_OFFSET_OOB) pick 53504a2 NAND: formatting cleanups from env.oob support
...
# Commands:

#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
Signature · 3 lines
Best Regards
Xiangfu Liu
http://www.openmobilefree.net
#12 lore raw
In reply to Wolfgang Denk
Quoted 8 lines · Wolfgang Denk

Dear Graeme Russ,

Quoted 3 lines · In message <[email protected]> you…

I'm sure you'll argue that this is poor development management, but I find myself more efficient if a 'get in the zone' and then go back and break things up. It also serves as a really good self imposed code review

Quoted 8 lines

No, I don't argue. I'm trying to undestand. I am well aware that there are many tools for the same tasks, and the most efficient ones are these you know well, so "vi" is probably much more eficient to me than your favorite editor is to you. But I always like at least to know what the tools can do that I don't use or don't know that well - sometimes - sometimes i's time to make room in the toolbox for a new tool or another :-)

Knowing what tools others use (and those tools influence how people work) is very helpful in understanding how and why people do what they do

You have a very good grip on git, and I would suggest stg is not really going to make your life any easier. I know only a few git commands, so stg is good for me. Who knows, over time I may get to know git well enough to not need stg any more ;)

--
Graeme

#13 lore raw
In reply to Fabio Giovagnini
Quoted 8 lines · Fabio Giovagnini

Hi all,
for sending a patch do I need to have on my PC two u-bbot tree, one original obtaned by git command, and another to make the modifications?

Or can I produce the patches using the original tree resident on git server?

Thanks

Hi Fabio,

you get an introduction how to send patches to ML here:

http://www.denx.de/wiki/U-Boot/Patches

And you get a lot of docs on git on kernel.org. In your case, you do not need to work directly with patch, git makes the job for you. all you need is:

- make your changes in your tree (if you want to make things simple)
- git commit (be sure to add your signed-off and to set a useful comment)
- git format patch HEAD~1 (or better check the man page for it..)

That's all. I suggest you to use git send-email to send your patch to the ML to avoid some corruption by your e-mail client.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#14 lore raw
In reply to Fabio Giovagnini

Dear Fabio Giovagnini,

Quoted 3 lines · In message <[email protected]> you wrote:

for sending a patch do I need to have on my PC two u-bbot tree, one original obtaned by git command, and another to make the modifications?

No. You can work in a single tree, for example by using one or more development branches.

Try to read one of the available introductions into git.

Quoted 1 line

Or can I produce the patches using the original tree resident on git server?

There is no such thing as a git server. Each copy of the git repository is complete and independent - kind of it's own server. Once you have cloned the repository somewhere, you can work independently.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If something is different, it's either better or worse,  and  usually
both.                                                    - Larry Wall