Find previous chunk to stage - tig

How do I navigate to the previous chunk to stage when viewing a single file in tig status mode?
What I'm looking for is the opposite to stage-next (mapped to # by default), but there is no stage-previous that I can find.
A previous question here at StackOverflow regarding a non-existing feature functioned somewhat as a feature request, which was later filled and referenced in an answer, which I'd love to see again if applicable.

As you point out there is no stage-previous. The preferred way to do this is to add a keybindings for prompt commands. Example:
bind stage 2 :?^##
bind stage D :/^diff
Note that this is using a new feature that will be part of the upcoming release of version 2.0.

Related

Garbage characters in approved Chrome Extension

Trying to solve a mystery here... Submitted an extension update and it was approved last night and I rolled it out shortly after. I discovered that a JS error was thrown in the newly rolled out release...
Invalid or unexpected token
This error was not thrown in the build submitted for review. After inspecting the compiled js in the rolled out version, I discovered a bunch of garbage characters that were not present in the uploaded extension...
I'm wondering if the extension was got corrupted in the review process? Has this happened to anyone else? I've submitted a new build for review with no changes and am hoping that this one will not have these garbage characters.
Someone don't want to admit it, but it happens more than you want to believe.
There are certain characters that are not always digested by the publication / review process.
The same character once passes and another time it gets busted.
It happened to me with the character §
In short, I suggest you to avoid these characters or use their escape sequence instead (i.e. space = = )
If this translation has had persistent implications, such as having incorrectly set items of some storage system (localStorage, chrome.storage indexedDB etc.), after replacing your character with the corresponding escape sequence, you will also have to try to put a patch on it to restore the expected value of such variables \ objects.
In my specific case I had to insert some code inside the onInstalled event handler checking if the user is updating from that "faulty" version.

How to view merge review comments and file changes in GitLab?

I'm performing a merge review (code review) in GitLab. I entered some file comments then the author responded to the comments and made some changes to the files. I can view the comment thread, and the relevant portion of the original file on the merge request Overview page. And a link there will take me to a diff between the original and changed files.
But how can I see the comment, response and file diff at the same time? Open the diff link in a new window?
GitLab version = Enterprise Edition 12.10.1-ee
(Newbie stackexchange user - Apologies for any breaches of etiquette.)
Check if GitLab 14.6 (December 2021) improves your use case:
View inline the change that outdated a merge request thread
When addressing review feedback in merge requests, you often change lines your reviewers have commented on.
In those comment threads, GitLab indicates that new changes were made.
However, to understand if those new changes address the feedback, reviewers would have to navigate away from the context of the discussion.
Now, when viewing threads related to old changes, you can view the new changes directly in the thread.
This improved context helps you review faster and more accurately.
See Documentation and Issue.
If you want to see all the merge requests, you can check that in the left panel as 'Merge request' option. If you check the particular merge request, you can see Discussion, Commits , Changes at the bottom. It will be easier here for you to check what changes has been made.

Can I get a list of wiki pages in GitLab?

I'm writing an app that uses the GitLab API, and I'd like to list the pages in the wiki. I can do something like http://gitlab/username/project/wikis/home.md to get the source of an individual file, and see all pages with http://gitlab/username/project/wikis/pages, but I can't do http://gitlab/username/project/wikis/pages.md due to a 500 error.
Is there a way I can retrieve the list of files in the wiki?
So there's now a GitLab Wiki API available which does everything I need:
https://docs.gitlab.com/ce/api/wikis.html
It can be used something like this:
https://gitlab.example.com/api/v4/projects/:project_id/wikis?with_content=1&private_token=yourtokenhere
Note; if this list is to facilitate a TOC (Table of content) for navigation purpose, you now have GitLab 13.5 (October 2020), which comes with:
Deep-level wiki navigation
In GitLab 13.5, along with the release of group wikis, we have another huge improvement in how to view and navigate the file structure of a wiki.
Currently, it’s very difficult to see where you are or understand the structure of a wiki if you have multiple folder levels. This makes it difficult to navigate, find pages, and mentally map your information.
With this release, we’ve introduced wiki deep nesting in the sidebar so you can see all of your pages and navigate accordingly.
See Documentation and Issue.
Possibly not what you wanted (and a bit late) but if you have modified your Sidebar (i.e. _sidebar) you can make a copy of it and then delete it.
You could also add link:pages[List all pages]
to your home page. That might avoid, somehow, the 500 you get from pages.md

Does Deactivate/Reactivate of a SharePoint Feature Increment the Version?

We have a complex scenario which requires a timer job to run after content deployment to a SP 2010 site collection. The timer job automatically deactivates/reactivates a branding feature which is responsible for setting the master page for the site collection, among other things.
We have had several feature upgrades along the way, and neglected to call .Update() on the feature in that specific site collection. So all of the updated CSS, master page, page layouts etc. are out of date on that SC.
The strange part is that when I checked the version number of that feature in this SC, it shows as the latest version. The custom upgrade action clearly didn't run and update the files, because nobody called .Upgrade().
One of my colleagues suggested that the deactivate/reactivate process done by the timer job would update the version number, meaning that I can no longer call Upgrade()!
Is that true? Does a deactivate/reactivate cycle for a feature automatically update the feature version number?
Is there an easy way to fix this mess? Some way to decrement the version number programmatically, then call Upgrade()??
On 1: No. Feature deactivating / activating does not trigger an update. See this article by Chris O' Brian: http://www.sharepointnutsandbolts.com/2010/06/feature-upgrade-part-1-fundamentals.html
Feature upgrade does NOT happen automatically (including when the
Feature is deactivated/reactivated)! The only way to upgrade a Feature
is to call SPFeature.Upgrade(), typically in conjunction with one of
the QueryFeatures() methods. My tool which I’ll go on to talk about is
a custom application page which helps you with this part – note there
is no STSADM command, PowerShell cmdlet or user interface to do this
out-of-the-box.
Is your timer job cycling the feature activation with Force? Then, yes, it is triggering the feature upgrade/feature update see the following screenshot from SPFeature.Activate (see my yellow marking):
Why the feature version is incremented, I'm not sure. When you have a feature, install a new feature version and activate / deactivate, the feature version stays the same unless you run an Upgrade, see also this related question stating the same: https://sharepoint.stackexchange.com/questions/41476/feature-upgrading-question
I'm guessing your timer job is using force? Otherwise I'm not quite sure what is happening.
On 2: Don't know if it is possible to decrease the version number, but the safest way would be to just create a new version including a grand "clean up" feature receiver which sets everything correct, i.e. checks which steps of the feature upgrade have happened already (e.g. new list created, new content type added) and which haven't. Depending on that just execute the same steps again which have not executed yet. For the latter part you can fortunately use the existing code, so you would only need the "clean up" or checking code.
After some testing I found that simply deactivating and reactivating the feature will increment the version number and completely screw up your upgrade! I even watched the update come through in the content database. As soon as you deactivate/reactivate the updated feature, the new version number pops into the content DB. Of course the upgrade doesn't actually run, it just increments the version number.
This means that if you then call .Upgrade() it won't work because SharePoint thinks it's already been upgraded!!
To fix this I updated the row in the content database to set the feature version back to 0.0.0.0 for that particular web and then I could run .Upgrade() just fine....but that's not exactly a supported solution. If anyone else has a better idea drop a reply.

Code fragment repository search on github.com

How can I search for code fragments on github.com? When I search for MSG_PREPARE in the repository ErikZalm/Marlin github shows up nothing.
I'm using the repository code search syntax described on https://github.com/search with
repo:ErikZalm/Marlin MSG_PREPARE
No results, but MSG_PREPARE can be found inside this repository here. Am I missing something? Is there no code search on github.com?
At the time of writing this answer, compared to time this question was asked i.e. about 8 years ago, github has come a good way, though still not to the length which you are looking at.
GitHub code searches are limited on the following rules: https://docs.github.com/en/github/searching-for-information-on-github/searching-code . Quoting the same:
Code in forks is only searchable if the fork has more stars than the parent repository.
Forks with fewer stars than the parent repository are not indexed for code search.
To include forks with more stars than their parent in the search results, you will need to add fork:true or fork:only to your query.
For more information, see "Searching in forks."
So we can search within the fork using the fork:true option, though as expected, since the repo ErikZalm/Marlin is low on star count as compared to parent MarlinFirmware/Marlin, the code in the fork is still not indexed. Hence the advance search shows no good except a match to the repo.
Though, if you perform the same search on the parent, it would show the matches on the code. Here are the matches for MSG_PREPARE in the parent repo MarlinFirmware/Marlin
Fortunately, one company which I know working on this domain is SourceGraph: https://about.sourcegraph.com/
Hence, you can easily search what you intended with SourceGraph:
Here are the matches for MSG_PREPARE in the ErikZalm/Marlin using SourceGraph Cloud
Update July 2013: "Preview the new Search API"
The GitHub search API on code now supports fragments, through text-match metadata.
Some API consumers will want to highlight the matching search terms when displaying search results. The API offers additional metadata to support this use case. To get this metadata in your search results, specify the text-match media type in your Accept header. For example, via curl, the above query would look like this:
curl -H 'Accept: application/vnd.github.preview.text-match+json' \
https://api.github.com/search/code?q=octokit+in:file+extension:gemspec+-repo:octokit/octokit.rb&sort=indexed
This produces the same JSON payload as above, with an extra key called text_matches, an array of objects. These objects provide information such as the position of your search terms within the text, as well as the property that included the search term.
Original answer (November 2012)
I don't think there is anything that you would have missed.
If you search for SdFile, you would find results in .pde file, but none in cpp files like in this SdFile.cpp file.
The search was introduced 4 years ago (November 2008), but, as mentioned in "Search a github repository for the file defining a given function", GitHub repository code is simply not fully indexed.

Resources