How can I show the branches in `git log -- dir`? - git-log

I can run git log -- doc in, for example, this fairly small repository. However, the branches are not displayed unless the tip of that branch made a change inside the directory I specify. I would like to see the branch names displayed on the latest commit on that branch that touched the directory.
This is similar to how, in GitExtensions, you can request the 'History of a directory / file' while still also seeing the branches involved. It is especially useful when you are resolving a difficult merge/rebase conflict, or tracking down a bug in that code, because you can see the branches which the other modifications were on, so you also know if particular changes were already merged into master or not.
I specifically need a way to output this on the commandline, such as by passing parameters to git log, or a custom shell script, because the output of git log is used by my git GUI (vim-flog).

I got a sort-of fix from someone; good enough to mention, but it shows a branch for every commit, regardless if there is some more recent commit on the branch also visible:
Add %S to your pretty format, e.g.:
$ git log --graph --all --format='(%S) %h %s' -- doc
The --all is essential, otherwise it is always 'HEAD'.
* (refs/heads/master) 2f8558b user-changes.md: document SPDX license expressions (#683)
* (refs/heads/master) 9ad7f20 user-changes.md: Add markers for releases (#684)
| * (refs/remotes/origin/feat/crate_config) 2d08fa4 Typos
| * (refs/remotes/origin/feat/crate_config) 7b7e342 Typos
| * (refs/remotes/origin/feat/crate_config) a81c5b1 Add more documentation for crate configuration
| * (refs/remotes/origin/feat/crate_config) 3071227 Crate configuration: new manifest syntax
| * (refs/remotes/origin/feat/crate_config) 4eb8180 catalog-format-spec.md: start documentation of crate configuration
|/
* (refs/remotes/origin/feat/crate_config) a689ee3 Automatically narrow down dependencies given as "any" (#675)
* (refs/remotes/origin/feat/crate_config) 70add12 Warn about ^0.x dependencies (#669)
* (refs/remotes/origin/feat/crate_config) c763b00 Rename `alr list` to `alr crates` (#671)
* (refs/remotes/origin/feat/crate_config) 8c1e893 Clarify current behavior of actions (#672)
* (refs/remotes/origin/feat/crate_config) 185b1e1 Remove use of build/clean relocations (#667)
* (refs/remotes/origin/feat/crate_config) b9e8a64 Alire.Properties.Licenses: Add support of SPDX expression (#629)
* (refs/remotes/origin/feat/crate_config) ccab133 Allow unknown enum values in index manifests and new `index --check` (#656)
* (refs/remotes/origin/feat/crate_config) 226e9b6 Alr.Commands.Edit: add support for custom editor (#611)
* (refs/remotes/origin/feat/crate_config) ca526e6 policies.md: add best practices (#597)
* (refs/remotes/origin/feat/crate_config) bcca503 Migration of an existing Ada/SPARK project to Alire (#598)
* (refs/remotes/origin/feat/crate_config) 7b9b7f9 Change Windows installer icon (#589)
* (refs/tags/v0.7.0) b5ad3d2 Fix the `depends-on` example in the catalog spec (#581)
* (refs/tags/v0.7.0) 378baa6 doc/getting-started.md: replace "setenv" with "printenv" (#576)
* (refs/tags/v0.7.0) e5c1ba9 Added paragraph about adding an ALR badge (#574)
* (refs/tags/v0.7.0) cc594c0 catalog-format-spec.md: fix gpr-set-externals description (#572)
* (refs/tags/v0.7.0) a824354 reviewed for English grammar, spelling, etc. (#561)
* (refs/tags/v0.7.0) dbd33cf Spelling fixes and README update (#559)
* (refs/tags/v0.7.0) fbb77b5 Update getting-started with install from binary distribution (#558)
* (refs/tags/v0.7.0) 4f6fc2c Create tarball from Alire workspace (#529)
* (refs/tags/v0.7.0) 7f1f9bc actions: rename post-compile into post-build and add pre-build (#537)
* (refs/tags/v0.7.0) be01f9c Updated documentation for new `alr publish` (#524)
* (refs/tags/v0.7.0) b372688 Added `user-changes.md` log for new `publish` feat

Related

cookie cutter: what's the easiest way to specify variables for the prompts

Is there anything that offers replay-type functionality, by pointing at a predefined prompt-answer file?
What works and what I'd like to achieve.
Let's take an example, using a cookiecutter to prep a Python package for pypi
cookiecutter https://github.com/audreyr/cookiecutter-pypackage.git
You've downloaded /Users/jluc/.cookiecutters/cookiecutter-pypackage before. Is it okay to delete and re-download it? [yes]:
full_name [Audrey Roy Greenfeld]: Spartacus 👈 constant for me/my organization
email [audreyr#example.com]: spartacus#example.com 👈 constant for me/my organization
...
project_name [Python Boilerplate]: GladiatorRevolt 👈 this will vary.
project_slug [q]: gladiator-revolt 👈 this too
...
OK, done.
Now, I can easily redo this, for this project, via:
cookiecutter https://github.com/audreyr/cookiecutter-pypackage.git --replay
This is great!
What I want:
Say I create another project, UnleashHell.
I want to prep a file somehow that has my developer-info and project level info for Unleash. And I want to be able to run it multiple times against this template, without having to deal with prompts. This particular pypi template gets regular updates, for example python 2.7 support has been dropped.
The problem:
A --replay will just inject the last run for this cookiecutter template. If it was run against a different pypi project, too bad.
I'm good with my developer-level info, but I need to vary all the project level info.
I tried copying the replay file via:
cp ~/.cookiecutter_replay/cookiecutter-pypackage.json unleash.json
Edit unleash.json to reflect necessary changes.
Then specify it via --config-file flag
cookiecutter https://github.com/audreyr/cookiecutter-pypackage.git --config-file unleash.json
I get an ugly error, it wants YAML, apparently.
cookiecutter.exceptions.InvalidConfiguration: Unable to parse YAML file .../000.packaging/unleash.json. Error: None of the known patterns match for {
"cookiecutter": {
"full_name": "Spartacus",
No problem, json2yaml to the rescue.
That doesn't work either.
cookiecutter.exceptions.InvalidConfiguration: Unable to parse YAML file ./cookie.yaml. Error: Unable to determine type for "
full_name: "Spartacus"
I also tried a < stdin redirect:
cookiecutter.prompts.txt:
yes
Spartacus
...
It doesn't seem to use it and just aborts.
cookiecutter https://github.com/audreyr/cookiecutter-pypackage.git < ./cookiecutter.prompts.txt
You've downloaded ~/.cookiecutters/cookiecutter-pypackage before. Is it okay to delete and re-download it? [yes]
: full_name [Audrey Roy Greenfeld]
: email [audreyr#example.com]
: Aborted
I suspect I am missing something obvious, not sure what. To start with, what is the intent and format expected for the --config file?
Debrief - how I got it working from accepted answer.
Took accepted answer, but adjusted it for ~/.cookiecutterrc usage. It works but the format is not super clear. Especially not on the rc which has to be yaml, though that's not always/often the case with rc files.
This ended up working:
file ~/.cookiecutterrc:
without nesting under default_context... tons of unhelpful yaml parse errors (on a valid yaml doc).
default_context:
#... cut out for privacy
add_pyup_badge: y
command_line_interface: "Click"
create_author_file: "y"
open_source_license: "MIT license"
# the names to use here are:
# full_name:
# email:
# github_username:
# project_name:
# project_slug:
# project_short_description:
# pypi_username:
# version:
# use_pytest:
# use_pypi_deployment_with_travis:
# add_pyup_badge:
# command_line_interface:
# create_author_file:
# open_source_license:
I still could not get a combination of ~/.cookiecutterrc and a project-specific config.yaml to work. Too bad that expected configuration format is so lightly documented.
So I will use the .rc but enter the project name, slug and description each time. Oh well, good enough for now.
You are near.
Try this cookiecutter https://github.com/audreyr/cookiecutter-pypackage.git --no-input --config-file config.yaml
The --no-input parameter will suppress the terminal user input, it is optional of course.
The config.yaml file could look like this:
default_context:
full_name: "Audrey Roy"
email: "audreyr#example.com"
github_username: "audreyr"
cookiecutters_dir: "/home/audreyr/my-custom-cookiecutters-dir/"
replay_dir: "/home/audreyr/my-custom-replay-dir/"
abbreviations:
pp: https://github.com/audreyr/cookiecutter-pypackage.git
gh: https://github.com/{0}.git
bb: https://bitbucket.org/{0}
Reference to this example file: https://cookiecutter.readthedocs.io/en/1.7.0/advanced/user_config.html
You probably just need the default_context block since that is where the user input goes.

Getting error " not enough arguments in call to s.statsd.SendLoop" when running "go build" command

I'm trying to run go build command for my project but it exits with below error.
alpha#GHOST-RIDER:~/GoWorkspace/src/github.com/hyperledger/firstproject$ go build
# github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric/core/operations
../fabric-sdk-go/internal/github.com/hyperledger/fabric/core/operations/system.go:227:23: not enough arguments in call to s.statsd.SendLoop
have (<-chan time.Time, string, string)
want (context.Context, <-chan time.Time, string, string)
Any help would be appreciated.
As per code fabric is using the different version of this library: github.com/go-kit/kit/metrics/statsd. If you follow the System struct's statsd attribute, you can reach the reference on imports.
In master branch of this lib, SendLoop function requires 4 attributes, so that's the root cause. So this causes error when you compile on your local environment.
I had the same issue and worked around it by checking out a tag of library as below:
cd $GOPATH/src/github.com/go-kit/kit
git fetch --tags
git checkout v0.8.0
found a solution on the hyperledger-fabric-go-sdk group chat.
Add context.Background() in s.statsd.SendLoop like below
s.statsd.SendLoop(context.Background(), s.sendTicker.C, network, address)
in fabric-sdk-go/internal/github.com/hyperledger/fabric/core/operations/system.go file at line 227.
I had a same issue, my solution worked and don't need edit fabric source code.
specify github.com/go-kit/kit to v0.8.0, modify go.mod:
replace github.com/go-kit/kit => github.com/go-kit/kit v0.8.0 // you specific version
require (
... ...
// Maybe other version, go mod tidy update automatically, don't care it.
github.com/go-kit/kit v0.9.0 // indirect
... ...
)
then it worked.

Sublime Text: can not download with sync-setting package due to randomly changed "ignored_packages" list

I am trying to download/install some 50+ packages with "Sync Settings" package. So, I do Preferences > Packages Settings > Sync Settings > Settings - and my User file's contents are like below.
{
/**
* This token allow to plugin do:
* - Create a Gist
* - Download a Gist
* - Upload a Gist
* - Delete a Gist
*/
"access_token": "54564545454545646465456+4651465",
/**
* Gist identifier for upload your configuration
*/
"gist_id": "hd4554dsg45g5d4gjjmd54",
/**
* Download automagically the new version on ST startup
*/
"auto_upgrade": false
}
But it fails, giving me the below error pop-up
It appears a package is trying to ignore itself, causing a loop.
Please resolve by removing the offending ignored_packages setting.
And then when I navigate to Preference > Settings I see the below
{
"ignored_packages":
[
"Vintage"
]
}
I have looked through this issue, but it did not resolve my problem.
My system settings
Ubuntu - 18.04
Sublime Text - version 3.2 Build 3200
This just happened to me, but it seemed to resolve itself upon retrying. I just dismissed the warnings as they popped up and then let it finish downloading all of my packages. Then, I restarted Sublime (not sure if this was necessary) and downloaded the settings once more (not sure if this was necessary either). The second time, there were no errors.

project.compileClasspathElements defaults between Maven 2 and 3

I inherited a Maven project/module that failed when I switched from Maven 2 to Maven 3. It hinges on the execution of an external program that depends on the contents of project/module/target/classpath.txt. This file is generated by a custom plugin that uses ${project.compileClasspathElements}.
In Maven 2 this contained:
project/module/target/classes
[all my dependencies in my local repository]
But in Maven 3, the classpath.txt file only contains:
project/module/target/classes
In other words, the file is missing all the actual dependencies, save for the build directory. Was there a change between Maven 2 and Maven 3 regarding project.compileClasspathElements? How can I get all the dependencies back so that it will work like Maven 2?
[This question was edited to reflect the source of classpath.txt, which I only just discovered.]
Just encountered this issue when migrating a maven 2 plugin that executes during the package phase. Fixed by adding
#requiresDependencyResolution compile+runtime
to the Mojo, e.g.
/**
* blah blah blah
*
* #goal validate-security
* #phase package
* #requiresDependencyResolution compile+runtime
*/
public class SecurityValidationMojo extends AbstractMojo { ... }
From http://maven.apache.org/developers/mojo-api-specification.html
If this annotation is present but no scope is specified, the scope defaults to runtime. If the annotation is not present at all, the mojo must not make any assumptions about the artifacts associated with a Maven project.

Haddock: Failed to create dependency graph (when adding sections with * or a module heading)

I compiled and installed haddock-2.4.2 from the tarball source.
Adding a few simple comments to the code here:
https://dl.getdropbox.com/u/143480/doc/DualMap.hs
and running haddock
$ haddock -h -o doc Data/DualMap.hs
Warning: Data.DualMap: could not find link destinations for:
Data.Typeable.Typeable2 GHC.Base.Eq GHC.Show.Show GHC.Base.Ord GHC.Base.Bool Data.Set.Set
yields:
https://dl.getdropbox.com/u/143480/doc/Data-DualMap.html
Things look good. (Note that this module only depends on libs that ship with GHC and no other source modules.)
However, when I try to add sections (a la http://www.haskell.org/haddock/doc/html/ch03s04.html#id289234 ) in the comments with "-- * test" I get:
$ haddock -h -o doc Data/DualMap.hs
Data/DualMap.hs:20:0: parse error on input `-- * test'
haddock: Failed to create dependency graph
I have no idea where to begin getting this to work since this error message only tells me that Haddock.Interface.depanal returned Nothing (according to a grep of the haddock sources) but not how to stop the dependency analysis from failing. Perhaps I need some more command line arguments or references to missing link destinations in GHC/base/containers documentation or some haddock config file?
Searching Google yielded plenty of cabal build errors of the same ilk for packages on hackage but nothing about how to fix them.
How do I add sections (with asterisks) and get Haddock to generate my docs? What (probably simple thing) am I missing?
Simple fix (terrible error message):
Move the ( up to the line with the module name. Previous bad code:
module Data.DualMap
-- * The #DualMap# abstract type
( DualMap ()
-- * (?) internal? -- exposed for testing purposes, for now...
, dmFlip
-- * converting to and from DualMap
, toList, fromList, map
-- * constructing a DualMap
, empty, null, insert, union
Happy code looks like this:
module Data.DualMap (
-- * The #DualMap# abstract type
DualMap ()
-- * (?) internal? -- exposed for testing purposes, for now...
, dmFlip
-- * converting to and from DualMap
, toList, fromList, map
-- * constructing a DualMap
, empty, null, insert, union
Simple enough. I found this out by downloading DList from hacakge and gutting it and replacing the code with my own code. When DList worked with 'cabal haddock' and mine didn't (when I tried to add some asterisks), I looked at the difference between the files and sure enough my parenthesis was on the wrong line.
BTW I highly recommend DList as a starting place for a new Haskell project instead of hnop.

Resources